1. Create a new file under the store file and write the following code
/** * Store ** Data * **/ // initial state const state = { all: { ID:'', BrandID:'' } } // getters const getters = {} // actions const actions = {} // mutations const mutations = { setPrint(state, all) { //Set parameters = all; } } export default { namespaced: true, state, getters, actions, mutations }
Note: Remember to import this file into the file below the store
import Vue from 'vue'; import Vuex from 'vuex'; import print from './module/print'; const debug = .NODE_ENV !== 'production'; (Vuex); export default new ({ modules: { print }, strict: debug, //Open strict mode plugins: debug ? [createLogger()] : [] })
2. Save the data into vuex (write it on the page where the data is to be stored)
this.$("print/setPrint", { //print represents the file name of vuex ID: , BrandID: 402 });
3. Take out the data from vuex and use it (write it on the page you want to use)
import { mapState, mapActions } from "vuex"; computed: { ...mapState({ print:state=> }) }
Just write the following code directly where it is used:
= ; = ;
The above article vue implements the data stored in vuex and extracting data from vuex is all the content I share with you. I hope it can give you a reference and I hope you can support me more.