vue异常记录method is not defined
vue 异常,method is not defined
·
调试vue发现错误,提示方法没有定义,在IDE工具提示是要注意选择正确的选项:
代码:
new Vue({
el: '#blist',
delimiter: ['[[', ']]'],
data: {
message: 'hi vueeee',
},
method: {
getbooks: function () {
console.log(123)
var url = "http://127.0.0.1:8000/booklist/books_view"
axios.get(url).then((response) => {
console.log(response)
}).catch((error) => {
console.log(error)
})
}
}
})
异常如下:
[Vue warn]: Property or method “getbooks” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data
原因:关键词拼写错误,pycharmt提示不小心选错
应是:methods,delimiters
pycharm提示多个,注意选择正确的:
更多推荐
已为社区贡献1条内容
所有评论(0)