VUE常见问题整理

vue项目打包element-icons路径错误
1.在build/utils下的ExtractTextPlugin.extract下添加publicPath:'../../'

if (options.extract) {
  return ExtractTextPlugin.extract({
    use: loaders,
 fallback: 'vue-style-loader',
 publicPath:'../../'
 })
} else {
  return ['vue-style-loader'].concat(loaders)
}

2.更改config/index.js中build下的assetsPublicPth, 原本为/, 改为./

index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',

v-for遍历数组错误:
提示:(Emitted value instead of an instance of Error) : component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.... for more info.
原因:错误的遍历方式:

{{key.name}}

循环必须要给每个循环体加上唯一的key:

{{key.name}}

你可能感兴趣的:(vue.js,javascript,前端)