Vue.js组件方法"未在实例上定义"

时间:2018-02-09 07:50:00

标签: javascript vue.js

我正在学习vue.js并使用vue-cli来设置一个新项目。现在我尝试将一个方法添加到组件但是出了点问题:

[Vue warn]: Property or method "removeTask" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

found in

---> <Settings> at src/views/Settings.vue
       <App> at src/App.vue
         <Root>

单击该按钮应调用removeTask函数,但它只是在控制台中输出错误:

{{1}}

这里有什么问题?

1 个答案:

答案 0 :(得分:0)

当我回到我的问题时,我注意到我错过了</script>结束标记。添加它解决了我的问题。