Parcourir la source

store deprecated and will be removed问题

chending1994 il y a 5 ans
Parent
commit
c4f7773275
1 fichiers modifiés avec 22 ajouts et 15 suppressions
  1. 22 15
      store/index.js

+ 22 - 15
store/index.js

@@ -1,10 +1,10 @@
-import Vue from 'vue'
-import Vuex from 'vuex'
+// import Vue from 'vue'
+// import Vuex from 'vuex'
 import axios from 'axios'
 
-Vue.use(Vuex)
+// Vue.use(Vuex)
 
-const state = {
+export const state = () => ({
 	wordpressAPI: 'http://visney.cn:81',
 	wordpressAPIForJob: 'http://visney.cn:8082',
 	headProdNav: {},
@@ -12,9 +12,9 @@ const state = {
 	headJobNav: {},
 	indexLinksData: null,
 	// indexShowLinks: false
-};
+}) 
 
-const mutations = {
+export const mutations = {
 	//头部导航产品与新闻信息
 		setHeadProdNav(state,data){
 			state.headProdNav = data
@@ -33,10 +33,10 @@ const mutations = {
 		// }	
 };
 
-const getters = {
+export const getters = {
 };
 
-const actions = {
+export const actions = {
 	async nuxtServerInit({commit,state,req}) {
 		
 		//产品导航
@@ -54,11 +54,18 @@ const actions = {
 	}
 };
 
-const store = () => new Vuex.Store({
-	state,
-	getters,
-	mutations,
-	actions
-})
+// export default {
+// 	state,
+// 	getters,
+// 	mutations,
+// 	actions	
+// }
+
+// const store = () => new Vuex.Store({
+// 	state,
+// 	getters,
+// 	mutations,
+// 	actions
+// })
 
-export default store
+// export default store