关于vue.js: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) <el-button v-for=”key in errType”>: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list…. for more info.
起因:谬误的遍历形式:

<el-button v-for="(key,index) in errType" v-on:click="selType(index,key.errtype)" v-bind:class="{on:seltype==index}">{{key.name}}</el-button>

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

<el-button v-for="(key,index) in errType" v-on:click="selType(index,key.errtype)" :class="{on:seltype==index}" :key="index">{{key.name}}</el-button>

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理