[Vuejs]-Clicking non Vuetify button does not update data in v-data-table

0👍

You are trying to trigger updateData method, which is accessible only inside the HTML element that Vue is mounted on. I assume you are mounting Vue to the element with id="app".

You have to put the button inside the <div id="app">:

<div id="app">
  <button @click="updateData()">Button</button>
  ...

Or, if you don’t need to access any Vue properties, you can just create a function inside script and trigger it with onclick event. Keep in mind that @click is also not accessible outside of Vue:

<button onclick="updateData()">Button</button>

<div id="app">
  ...
<script>
function updateData() {
  console.log('test')
}
</script>

Leave a comment