eslint [vue/no-unused-vars] error in vue template



也许这对某人有用。

我有包含 HTML 的 vue 模板

<template slot="HEAD_Status" slot-scope="data">
<!-- some html without using of data -->
</template>

Eslint 生成 [vue/no-un-used-vars] "data" 被定义但从未使用过。

我尝试使用 eslint-disable-line 没有任何成功(看起来像是因为它在 vue 文件中(:(

我编辑我的模板:

<template slot="HEAD_Status" slot-scope="{}"></template>

例如,将数据替换到插槽范围内的{}。

看起来像另一个解决方案,我们可以将 html 从 vue 模板移动到 html 文件:

<template src="./someTemaplte.html></template>

在某些Temaplte中.html插入我们的html:

<template slot="HEAD_Status" slot-scope="data"></template>

附言我没有尝试移动到 html 文件的解决方案。

最新更新