当前位置: 代码迷 >> 综合 >> vue3 引入ref toRefs 报错,报红波浪线
  详细解决方案

vue3 引入ref toRefs 报错,报红波浪线

热度:64   发布时间:2023-12-15 09:40:58.0

前言:Vue2代码检测工具使用的是【Vetur】,Vue3需要转换为【Eslint】,为了防止Vetur在Vue3项目中报错,同时需要开发Vue2项目,在此记录下相关配置

1、Vue3项目中添加【.vscode】文件夹,在文件夹在添加【settings.json】文件
在这里插入图片描述

{
    "editor.codeActionsOnSave": {
    "source.fixAll.eslint": false},// "editor.defaultFormatter": "esbenp.prettier-vscode","editor.formatOnSave": false,"eslint.enable": true,"eslint.options": {
    //指定vscode的eslint所处理的文件的后缀"extensions": [".js", ".jsx", ".ts", ".tsx", ".vue"]},"eslint.validate": ["javascript","javascriptreact","typescript","typescriptreact","vue"],"eslint.codeAction.showDocumentation": {
    "enable": true},"eslint.format.enable": true,"typescript.updateImportsOnFileMove.enabled": "always","[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode","editor.codeActionsOnSave": {
    // 保存时自动格式化"source.fixAll.eslint": true}},"[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode","editor.codeActionsOnSave": {
    // 保存时自动格式化"source.fixAll.eslint": true}},// .tsx"[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode","editor.codeActionsOnSave": {
    // 保存时自动格式化"source.fixAll.eslint": true}},"[vue]": {
    "editor.defaultFormatter": "dbaeumer.vscode-eslint",// "editor.defaultFormatter": "Wscats.vue","editor.formatOnSave": true,// "editor.codeActionsOnSave": {
    // "source.fixAll.eslint": false// }},"[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"},"[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"},"[less]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"},"[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"},"[markdown]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"},"vetur.validation.script": false,"vetur.validation.template": false,"vetur.validation.style": false,"typescript.tsdk": "node_modules/typescript/lib",
}