Closed ghost closed 3 years ago
<button @click="changeMsg(test)">Test</button>
Though, not 100% sure if you are asking that, or just trying to work out how to sync data.
If you just want to sync, use sync()
:
<template>
<div id="app">
<textarea v-model="message" />
<pre>{{ message }}</pre>
</div>
</template>
<script>
import { sync } from 'vuex-pathify'
export default {
computed: {
message: sync('message'),
},
}
</script>
import Vue from 'vue'
import Vuex from 'vuex'
import pathify, { make } from 'vuex-pathify'
Vue.use(Vuex)
const state = {
message: '',
}
const mutations = make.mutations(state)
export default new Vuex.Store({
plugins: [
pathify.plugin
],
state,
mutations,
})
If you want to submit after the local data is edited, then use call()
(or just this.$store.dispatch(..., data)
)
In app.vue file I have data which names "test" I want to send this data inside changeMsg function in my store.js How I send this data ? Can you help me?
App.vue
store.js