Explorar o código

会员中心手机端增加改变app标题栏的功能

wayne %!s(int64=6) %!d(string=hai) anos
pai
achega
5918e9e773
Modificáronse 1 ficheiros con 21 adicións e 0 borrados
  1. 21 0
      components/type/vip/mobile.vue

+ 21 - 0
components/type/vip/mobile.vue

@@ -164,6 +164,13 @@ export default {
           slideChange() {
             console.log(window)
             _this.current = this.realIndex
+            if (window.appBridge && _this.active===0) {
+              window.appBridge.setTitleBarColor('#D89823')
+            } else if (window.appBridge && _this.active===1 && _this.current===0) {
+              window.appBridge.setTitleBarColor('#308EFF')
+            } else if (window.appBridge && _this.active===1 && _this.current===1) {
+              window.appBridge.setTitleBarColor('#00BF66')
+            }
           },
           tap() {
             console.log('onTap', this);
@@ -208,6 +215,13 @@ export default {
   },
   mounted() {
     console.log("mobile", this.com, this.dev);
+    if (window.appBridge && this.active===0) {
+      window.appBridge.setTitleBarColor('#D89823')
+    } else if (window.appBridge && this.active===1 && this.current===0) {
+      window.appBridge.setTitleBarColor('#308EFF')
+    } else if (window.appBridge && this.active===1 && this.current===1) {
+      window.appBridge.setTitleBarColor('#00BF66')
+    }
   },
   methods: {
     clickPay(type) {
@@ -272,6 +286,13 @@ export default {
     handleSwitchClick(index) {
       this.active = index
       console.log(this.active)
+      if (window.appBridge && this.active===0) {
+        window.appBridge.setTitleBarColor('#D89823')
+      } else if (window.appBridge && this.active===1 && this.current===0) {
+        window.appBridge.setTitleBarColor('#308EFF')
+      } else if (window.appBridge && this.active===1 && this.current===1) {
+        window.appBridge.setTitleBarColor('#00BF66')
+      }
     }
   }
 };