From d4211fd96865e58217d63efaf4d8f6609fb24ae6 Mon Sep 17 00:00:00 2001 From: mh-two-thousand-and-two <17391232786@163.com> Date: 星期二, 16 四月 2024 17:43:33 +0800 Subject: [PATCH] 更新数据 --- src/store/index.js | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 1e278da..e97f289 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -6,7 +6,24 @@ const store = new Vuex.Store({ strict: true, + state:{ + // 鐢ㄦ埛璐﹀彿 + username:'sdf', + // 涓浗浜虹墿鏁版嵁搴撲腑鐨刬d + }, getters, + mutations:{ + Set_UserName(state,username){ + console.log(username,'uuu'); + state.username=username + } + }, + actions:{ + setUserName({commit},user){ + + commit('Set_UserName',user) + } + }, modules: { user }, plugins:[function(store){ // 鐩戝惉mutaions 璁板綍state鍒版湰鍦板瓨鍌� @@ -16,7 +33,7 @@ }) // 璇诲彇缂撳瓨涓璼tate if(uni.getStorageSync('state')){ - console.log(state,'aaaaaaaaastatestatestate'); + // console.log(state,'aaaaaaaaastatestatestate'); store.replaceState(Object.assign({},store.state,uni.getStorageSync('state'))) } }] -- Gitblit v1.9.1