// libs/utils.js
import store from '../store/index'
import Vue from '../main.js'
Vue.$TaLog({
  event_id: 'cb',
  event_comment: '去登陆'
})
store.commit('TOKEN', {
  name: 'isRepresent',
  value: isRepresent
})
// store/index.js
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    token: '',
    // 是代表吗
    isRepresent: false
  },
  mutations: {
    TOKEN (state, data) {
      state[data.name] = data.value
    }
  }
})
export default store

// main.js
import Vue from 'vue'
import router from './router'
import store from './store'
/* eslint-disable no-new */
var vue = new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
export default vue
Logo

前往低代码交流专区

更多推荐