Skip to content

Latest commit

 

History

History

replace-vue-key

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Vue 中 key 转换

替换 Vue 文件key的表示,以解决编译报错。

:key="'type' + index"

转为

:key="`type-${index}`"

如何使用

vue.config.js 中添加如下设置:

const { LOADER_MAP } = 'plugin-light/lib/loader';

module.export = {
  chainWebpack(config) {
    config.module
      .rule('vue')
      .test(/\.vue$/)
      .use(LOADER_MAP.replaceVueKey)
      .loader(LOADER_MAP.replaceVueKey)
      .end();
  }
}