Reputation: 1111
Trying to add to a store on click from an input. There would be multiple inputs with different parts of an objects info. How can I grab in input data from a method?
In this case, I'm working with packets via a store
<input label="Packet Name" v-model="packets.name" required><br>
<input label="Packet Name" v-model="packets.folder" required><br>
<button @click="addPacket">Add</button>
On the addPacket call how do I get the input data?
Full jsfiddle : https://jsfiddle.net/tga9sfcm/1/
Upvotes: 0
Views: 1221
Reputation: 10219
Here is a working fiddle
Also, note that you dispatch Actions and commit Mutations. You had your action dispatching a mutation: store.dispatch('ADD_PACKET', packet)
Upvotes: 1