Vue项目报错:error ‘scope‘ is defined but never used vue/no-unused-vars

在运行Vue项目时报错error 'scope' is defined but never used vue/no-unused-vars

错误是这里引起的

<template slot="header" slot-scope="scope">
  <el-input v-model="search" placeholder="请输入关键字搜索"/>
</template>

方法一

在WebStorm中修改package.json文件,在rules处修改为如下:

"rules": {
    
    
  "no-console": "off",
  "no-unused-vars":"off",
  "no-debugger": "off"
}

再次运行,有时有,有时没有。很头疼!

方法二

根据官方GitHub的issue上找到的很有效的方法,改为如下:

<template slot="header" slot-scope="{}">
  <el-input v-model="search" placeholder="请输入关键字搜索"/>
</template>

运行,再没报错了!

猜你喜欢

转载自blog.csdn.net/qq_27198345/article/details/113086230