0. 以管理员方式运行powershell

1.

vue init simulatedgreg/electron-vue my-project

// 1. 不要用eslint!不然对js格式要求严格

// 2. 用builder而不是packager,packager太慢了

2.

cd my-project

3.

cnpm install

4. 安装element-ui

cnpm install element-ui –save-prod

 

nginx.conf里面的:

server {
listen 80 default_server;
server_name localhost;
root /var/www/html/dist;

location / {
root /var/www/html/dist;
try_files $uri $uri/ @router
index index.html;
}

location $router {
rewrite ^.*$ /index.html last;
}

error_page 404 /404.html;
location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

 

/*

注意:

1)vue生成的dist目录放在/var/www/html下,如果放到/root/下的话,就会因为权限问题而nginx 403 forbidden

2) axios里的 base里面写的服务端api的地址如localhost、127.0.0.1等换成服务器http://ip