Can component methods be assigned to data variables using the example code below? It seems it is not working correctly. What could be the right way to do this?
<li v-for="item in items" @click="item.action">
{{ item.title }}
</li>
export default {
data: () => ({
items: [
{ title: "One", action: this.funcOne },
{ title: "Two", action: this.funcTwo },
]
}),
methods: {
funcOne() {
alert("Hi")
},
funcTwo() {
alert("Hello")
}
}
}