//错误代码
app.$watch('text', (newText, oldText) => {
  console.log('${newText} : ${oldText}')
})
//报错
36:15  error  Unexpected template string expression  no-template-curly-in-string

//*ES6的新语法,小撇号 使用 tab 键上面的引号 ``, 非 enter键旁边的引号''
//正确代码
app.$watch('text', (newText, oldText) => {
  console.log(`${newText} : ${oldText}`)
})

Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐