乐趣区

关于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>
退出移动版