From 153404ffa0a9c6d23d2c2732b46fa6929e86294f Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 18 六月 2025 13:56:18 +0800
Subject: [PATCH] 111
---
h5/store/index.js | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/h5/store/index.js b/h5/store/index.js
new file mode 100644
index 0000000..9441f1f
--- /dev/null
+++ b/h5/store/index.js
@@ -0,0 +1,34 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+
+Vue.use(Vuex)
+const userInfo = uni.getStorageSync('userInfo');
+
+const store = new Vuex.Store({
+
+ state: {
+ userInfo: userInfo || null // 鐢ㄦ埛淇℃伅
+ },
+ mutations: {
+ // 璁剧疆鐢ㄦ埛淇℃伅
+ setUserInfo(state, val) {
+ state.userInfo = val
+ uni.setStorageSync('userInfo', val);
+ }
+ },
+
+ actions: {
+ // 鑾峰彇鐘舵�侀珮搴�
+ getHeight(context) {
+ let res = uni.getMenuButtonBoundingClientRect()
+ let status = uni.getSystemInfoSync()
+ var height = res.height
+ let statusbarHeight = status.statusBarHeight
+ let navHeight = res.height + (res.top - statusbarHeight) * 2;
+ context.commit('setHeight', { statusbarHeight, navHeight, height })
+ }
+ }
+
+})
+
+export default store;
\ No newline at end of file
--
Gitblit v1.9.3