简体   繁体   English

vue 模板中的 eslint [vue/no-unused-vars] 错误

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

Maybe this will be useful to somebody.也许这对某人有用。

i have vue template with html in it我有带有 html 的 vue 模板

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

And Eslint generate [vue/no-unused-vars] 'data' is defined but never used.并且 Eslint generate [vue/no-unused-vars] 'data' 已定义但从未使用过。

I tried to use eslint-disable-line without any success (looks like because it's in vue file):(我尝试使用 eslint-disable-line 没有任何成功(看起来因为它在 vue 文件中):(

i edit my template:我编辑我的模板:

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

eg replace data to {} in slot-scope.例如,将数据替换为插槽范围内的 {}。

Looks like another solution, we can move html from vue template to html file:看起来像另一个解决方案,我们可以将 html 从 vue 模板移动到 html 文件:

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

And in someTemaplte.html insert our html:在 someTemaplte.html 中插入我们的 html:

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

PS i didn't try the solution with a move to html file. PS 我没有尝试使用 html 文件的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM