problem description
The definition of self = this inVue created points to the current vue instance, but the use of self in methods does not point to the current instance correctly.
related codes
new Vue({
el: "-sharpvue",
data: {
col: "dd"
},
created: function () {
self = this
},
methods: {
render: function() {
jQuery.get(ajaxurl, function (res) {
self.dd = "ee"
})
}
}
})
self.dd data col
new Vue({}) data col: "dd"
self.dd vue