Vue.js 中意外的模板字符串表达式 [英] Unexpected template string expression in Vue.js

查看:31
本文介绍了Vue.js 中意外的模板字符串表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我这样编码 ${row.name} 时,我都会收到此错误eslint.org/docs/rules/no-template-curly-in-string Unexpected template string expression".

everytime I code like this ${row.name}, I get this error "eslint.org/docs/rules/no-template-curly-in-string Unexpected template string expression".

有什么帮助吗?

推荐答案

ES6 模板字符串应该与反引号一起使用,而不是单引号.替换这个:

ES6 template strings should be used with backquotes, not single quotes. Replace this :

'delete the item ${row.name}'

有了这个:

`delete the item ${row.name}`

这里是评论中要求的 ESLint 示例:http://eslint.org/docs/rules/no-template-curly-in-string#examples

And here is the ESLint example as requested in the comments : http://eslint.org/docs/rules/no-template-curly-in-string#examples

这篇关于Vue.js 中意外的模板字符串表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆