Reputation: 33
I have emmited data from a component and I want to pass this data in data() function.
Here's what I mean
export default {
name: "App",
data() {
return {
newlist
};
},
components: {
InputForms,
List
},
methods: {
handler(obj) {
obj = this.newlist;
}
}
};
I want obj
inside my handler
method to be inside data()
. Right now,this code is not compiling saying that newlist
is not defined
Upvotes: 0
Views: 65
Reputation: 8378
Change newlist
to newlist: {}
then inside your method swap what you already have:
handler(obj) {
this.newlist = obj;
}
Upvotes: 1