new Vue({
el: "#app",
data: {
checking: [
{ text: "Event 1 <a :click='test()' class='click'>click here</a>" },
{ text: "Event 2" },
{ text: "Event 3" },
{ text: "Event 4" }
]
},
methods: {
test() {
console.log("clicked")
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.2/vue.js"></script>
<div id="app">
<ul>
<li v-for="(check, i) in checking" :key="i" v-html="check.test"></li>
</ul>
</div>
Is it possible to create an event click in an object? I tried but always failed, maybe something's wrong in my code. Thank you.
here is my full code fiddle
