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>
发表回复