error ‘defineProps‘ is not defined no-undef

问题描述

今天在写项目的过程中,设计组件传值的过程中,居然报错了这个
看其他项目其实也没导入defineProps

在这里插入图片描述

解决方法——vue/setup-compiler-marcros

找到eslint.js文件,在env处添加下列代码

'vue/setup-compiler-macros': true

完整代码

module.exports = {
  root: true,

  env: {
    node: true,
    'vue/setup-compiler-macros': true
  },

  extends: [
    'plugin:vue/vue3-essential',
    '@vue/airbnb',
    '@vue/typescript/recommended',
  ],

  parserOptions: {
    ecmaVersion: 2020,
  },

  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
  },
};


版权声明:本文为qq_22841387原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。