export default {
name: 'SidebarMenu',
props: {item: {}},
data () {
return {
menuList: [{}]
}
},
created: function () {
this.getMenuList()
},
methods: {
getMenuList (event) {
$.getJSON('/cost-manager/sys/menu/user?_' + $.now(), function (r) {
// console.log(r)
this.menuList = r.menuList
})
}
}
}
*
menuList始终为空,赋值赋不上去,求解
*
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
在getjson外声明 var _self = this; _self.menuList = r.menu.List;
This binding rule:
Default Binding
Implicit Binding
Explicit Binding
new Binding
强烈建议对
this不了解的看下YDKJS的这篇文章这里
this指向不对,应该使用箭头函数: