From a971d0c13ab9cd5107152f6eba5e1e724a37fa0b Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期五, 07 六月 2024 17:20:31 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TCM_CharacterLibrary --- src/store/index.js | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 1e278da..d9aac7d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -6,17 +6,31 @@ const store = new Vuex.Store({ strict: true, + state:{ + // 鐢ㄦ埛璐﹀彿 + username:'sdf', + // 涓浗浜虹墿鏁版嵁搴撲腑鐨刬d + }, getters, + mutations:{ + Set_UserName(state,username){ + state.username=username + } + }, + actions:{ + setUserName({commit},user){ + + commit('Set_UserName',user) + } + }, modules: { user }, plugins:[function(store){ // 鐩戝惉mutaions 璁板綍state鍒版湰鍦板瓨鍌� store.subscribe((mutation,state)=>{ uni.setStorageSync('state',state) - console.log(state,'statestatestate'); }) // 璇诲彇缂撳瓨涓璼tate if(uni.getStorageSync('state')){ - console.log(state,'aaaaaaaaastatestatestate'); store.replaceState(Object.assign({},store.state,uni.getStorageSync('state'))) } }] -- Gitblit v1.9.1