nafeeur10
1 month ago
375
7
Vue

JSON String data button click is not working in Vuejs

Posted 1 month ago by nafeeur10
"element": [
  {
   "value": "<button @click='changeTheme()' class='theme-link btn btn-light'>Default</button>",
   "class": "text-success"
  }
]

I have bind the JSON data with Vue Component like the below:

<p v-else v-html="element[0].value"></p>

Now, I am trying to call this method. But it's not firing!

methods: {
  changeTheme() {
     alert("Y");
  }
}

Please sign in or create an account to participate in this conversation.