router开启(移除#号):
mode: 'history',
apache解决刷新页面访问404:点击打开链接
添加.htaccess 文件在dist根目录,内容如下:
ErrorDocument 404 /index.html
tomact解决刷新页面访问404:
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"id="WebApp_ID" version="3.1">
<error-page><error-code>404</error-code><location>/</location></error-page></web-app>
vuex解决ie不兼容问题
npm install --save babel-polyfill
在mian.js引用(vuex引用前)
import 'babel-polyfill'
非根目录部署:
-
设置webpack中index.js的assetsPublicPath
-
路由index.js
mode: 'history',base: '',
assetsPublicPath和base的路径一致
比如要发布到:www.jqvue.com/test/vue
base和assetsPublicPath的值:/test/vue/