1.elementui图标不显示
组件自带icon变成了小方块解决办法:build文件夹下的util文件中添加公共路径
if (options.extract) {
return ExtractTextPlugin.extract({ use: loaders,
publicPath: '../../',
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
2.去掉路由中的/#/
采用history模式 在路由导出函数的开头添加两行代码
mode: 'history',base: '/dist/',
采用history模式后页面刷新会显示404
修改配置文件中的路径 assetsPublicPath改为/(原来是./)
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
同时后台进行配合配置nginx.conf在location/{}中添加
try_files $uri $uri/ /index.html
详解:https://www.cnblogs.com/boundless-sky/p/9459775.html