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>