Vue

Vue
启动vue
npm run dev
部署vue项目
cnpm install -g vue-cli
cnpm install
cnpm install vue-ydui --save
删除项目目录下的 node_modules 目录,Linux下用root账户重新 npm install 或者 淘宝镜像 cnpm install ,Windows下用管理员权限运行terminal运行 npm install 或者 淘宝镜像 cnpm install。
删除node_modules
再执行cnpm install
还缺少的xxx就再cnpm install xxx
vue运行报错
删除package.json中
"dependencies": {
    "axios": "^0.16.1",
    "babel-runtime": "^6.23.0",
    "chalk": "^1.1.3",
    "jquery": "^2.2.3",
    "node-sass": "^4.5.3",
    "vue": "^2.2.6",
    "vue-router": "^2.3.1",
    "vue-ydui": "^0.5.8",
    "vuex": "^2.3.1"
  },
"vue-ydui": "^0.5.8",
nginx代理部署vue
nginx
location ^~ /mc/ {
        proxy_pass http://192.168.3.100:8082/;
        proxy_set_header   HOST             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
  apache
 .htacess
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule . /index.html [L]
</IfModule>
vue
config/index.js 配置
module.exports = {
build: {
assetsPublicPath: '/mc/', // 公共静态文件的路径前缀.
}
}
vue-router中的Route配置
const router = new Router({
base:'/mc/', // 路由路径的前缀,需要和 nginx 中的配置保持一致.
mode: 'history', // 切换路径模式,变成history模式
});

posted on 2018-10-12 11:19  阿释密达  阅读(115)  评论(0编辑  收藏  举报

导航