DESKTOP-O04BTUJ\muzen 3 سال پیش
والد
کامیت
4d61f204ad
1فایلهای تغییر یافته به همراه17 افزوده شده و 2 حذف شده
  1. 17 2
      src/App.vue

+ 17 - 2
src/App.vue

@@ -1,7 +1,22 @@
 <script>
 export default {
-  onLaunch(){
-    
+  globalData: {
+    statusBarHeight: 20,
+    userInfo: {}
+  },
+  onLaunch() {
+    // 获取App方法
+    getUserInfo.postMessage('获取用户信息')
+    getDeviceInfo.postMessage('获取设备信息')
+    // 暴露setUserInfo方法给APP
+    window['setUserInfo'] = res => {
+      console.log(res);
+      this.globalData.userInfo = JSON.parse(res)
+    }
+    window['setDeviceInfo'] = res => {
+      console.log(res);
+      this.globalData.statusBarHeight = JSON.parse(res).statusHeight
+    }
   }
 }
 </script>