the problem found during debugging yesterday is that the data in data and return data, can be called
data: {
name:libai
}
methods: {
function1(){
}
}
---------------------
return data(){
name: libai
},
methods:{
function1(){
}
}
if I call in a function, this.name can be called. But yesterday, when using a component, I used the render template according to the example, in which if data is used, the call to this.funtion1 (), shows that it is not defined, but if it is return data, it can be called to this.function1,. What is the difference between the two?
actual code
data(){
return {
{
align: "center",
title: "",
render: (h, params) => {
return h("div", [
h("i-button", {
props: {
type: "error",
size: "small",
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.remove(params.index)
axios({
method: "post",
url: "/delete_graph/",
data: Qs.stringify({"delete_name":params.row.name})
})
}
}
}, "Delete")
])
}
}
}
}
this part, if not used, the this.remove function in the return data click event is undefined. Is this not the component, is it the reason for the render function