I would like to click the button and change the vuejs data in formdata.eventname. But it does nothing after I click the button
Moreover, I don't know how to use vue.js in stackoverflow. If you know it, plz help me to edit the question
< script src = "https://unpkg.com/vue" >
<script >
new Vue({
el: "#app",
data: {
total: parseInt("<%= total %>"),
events: [],
current: 1,
perPage: 2,
rangeBefore: 1,
rangeAfter: 1,
order: "",
size: "",
isSimple: false,
isRounded: false,
prevIcon: "chevron-left",
nextIcon: "chevron-right",
formdata: {
eventname: "eventname2",
organizer: "",
starttime: "",
endtime: "",
venue: "",
},
},
methods: {
submitform: async function () {
this.formdata.eventname = "eventname1";
},
});
</script>
<button class="button is-link" @click="submitform()">Submit</button>
I make a stupid mistake. I didn't put the button inside the app.