当前位置: 首页 > news >正文

免费做海报的网站外贸局合并到哪个局

免费做海报的网站,外贸局合并到哪个局,玛伊网站做兼职加入要多少钱,天津建设网站需要的费用目录 问题描述 版本描述 问题定位 问题解决 VS Code 插件地址 问题描述 在 VS Code 上使用插件 Volar 开发 Vue3 项目&#xff0c;然后去改 Vue2 项目时&#xff0c;对没有放在<template v-for> 元素上的 :key&#xff0c;会提示 <template v-for> key should…

目录

问题描述

版本描述

问题定位

问题解决

VS Code 插件地址


问题描述

        在 VS Code 上使用插件 Volar 开发 Vue3 项目,然后去改 Vue2 项目时,对没有放在<template v-for> 元素上的 :key,会提示 <template v-for> key should be placed on the <template> tag.

原先 Vue2 项目开发时使用插件 Vuter。

Vue2 代码示例

<template v-for="(item, index) in list"><div :key="index" />
</template>

版本描述

Vue2 项目Vue3 项目
vue@2.6.14vue@3.2.19
eslint@4.19.1eslint@6.8.0
eslint-plugin-vue@4.7.1eslint-plugin-vue@7.18.0
babel-eslint@8.2.6babel-eslint@10.1.0

问题定位

eslint-plugin-vue 规则上关于key是否能置于<template v-for>上的冲突。

Priority A: Essential for Vue.js 2.x
规则vue/no-v-for-template-key: Disallow key attribute on <template v-for>

Priority A: Essential for Vue.js 3.x
规则vue/no-v-for-template-key-on-child: Disallow key of <template v-for> placed on child elements

上面这两个规则都是从版本 7.0.0 才开始加入

🚀 Version
This rule was introduced in eslint-plugin-vue v7.0.0

Vue2 项目使用的 eslint-plugin-vue@4.7.1 的文档仅有关于key能否置于<template>上的规则约束。

disallow key attribute on <template> (vue/no-template-key)

该规则从版本 3.4.0 开始加入

🚀 Version
This rule was introduced in eslint-plugin-vue v3.4.0

可见 eslint-plugin-vue@4.7.1 的 vue/no-template-key 约束了 key 的位置,不得放在<template>上。

        旧的 Vue2 项目的 key 并没有放在 <template> 上却报错:<template v-for> key should be placed on the <template> tag.,可以看出是被当成 Vue3 来检查了。

        这个提示属于 eslint-plugin-vue v7.0.0 版本及以上的规范,项目里的 eslint-plugin-vue 版本是 4.7.1,版本 7.0.0 的规范为什么会出现在这,还待查询......

        猜测是由于插件 Volar 未配置支持 Vue2 模板。


问题解决

  1. 禁用插件 Vetur,使用插件 Volar;
    Vue3 文档建议使用 Volar,配置好后就可只使用 Volar 同时开发 Vue2 & Vue3,而使用 Volar 需要禁用 Vuter:

    You need to disable Vetur to avoid conflicts.

  2. 在项目根目录增加文件 jsconfig.json,文件内容如下

    {"vueCompilerOptions": {"experimentalCompatMode": 2},
    }
    

以上解决方法参考的是 Volar 关于 tsconfig.json 的设置

Using
Setup for Vue 2
3.Support Vue 2 template
Volar preferentially supports Vue 3. Vue 3 and Vue 2 template has some different. You need to set the experimentalCompatMode option to support Vue 2 template.

// tsconfig.json
{"compilerOptions": {...},"vueCompilerOptions": {"experimentalCompatMode": 2},
}

        我也不知道为什么这样是成功的,Vuter 文档有提及 jsconfig.json 的配置,Volar 文档仅提及了 tsconfig.json 的配置,就想着试下,就正常了


VS Code 插件地址

        Vuter [Vue2 项目使用的插件]
         [Vue3 项目使用的插件]

http://www.15wanjia.com/news/183917.html

相关文章:

  • 网站建设公司哪里有长沙官网网站推广优化
  • 有哪些程序做的网站潮州网站开发多少钱
  • 网站域名查询官网wordpress中文案例
  • 泰安房产网站企业网络营销策划书范文
  • 大连华南网站制作公司上海外贸进出口公司
  • 动易网站频道栏目字体大小修改网站上百度要怎么做的
  • 东莞如何编写网站建设wordpress本地图片不显示图片
  • 合肥网站seo诊断沧州快速关键词排名优化
  • 做网站主流网站免费发布推广信息的网站
  • 申请网站网站什么是网站设计种类
  • 想学网站开发网页素材网站有哪些
  • 网站建设 用户管理页面设计培训学校
  • 新建设电影院 网站做网站四百全包
  • 网站建设百度首页公司域名备案
  • 怎么样申请网站售后管理系统软件
  • 网站优化排名易下拉技术长沙企业网站建设企业
  • 网站制作公司排名前十wordpress博客只显示几个
  • 中小型网站建设新闻公司网站手机端和电脑端
  • l林州住房建设部官方网站wordpress 跑马灯插件
  • 苏州建设银行招聘网站厦门建网站网址
  • 深圳建设银行官方网站百度网站怎么优化排名
  • 郑州建设企业网站找哪个公司室内设计效果图制作教程
  • 高端企业网站建设公司一般通过哪些行为来处理人际关系
  • 明星 卡片网站该怎么做wordpress书画
  • 怎么制作网站下载软件网站主页设计注意点
  • 手机网站开发成appseo顾问服务 品达优化
  • 做音乐 交流网站天津市建设
  • 前端网站论文源代码代做网站
  • wordpress企业站实例目前流行的网站开发技术
  • 常州本地做网站的大公司长沙制作公司宣传片哪家好