H5 调安卓这边写法

2019-11-23  本文已影响0人  如果俞天阳会飞
computed: {
    ifNative() {
      return typeof HostApp !== 'undefined';
    },
  },
proxyRequest(funName, param = {}, callBack = () => {}) {
      if (this.ifNative) {
        if (this.$utils.versions().ios) {
        // eslint-disable-next-line
        WebViewJavascriptBridge.callHandler(funName, JSON.stringify(param), callBack);
        } else if (this.$utils.versions().android) {
        // eslint-disable-next-line
        HostApp.callHandler(funName, JSON.stringify(param), callBack);
        }
      } else {
        console.log(funName);
      }
    },
if (res.data.code === 0) {
            WebViewJavascriptBridge.callHandler(
              'getLocation'
              , {}
              , function (response) {
                that.appParams = JSON.parse(response)
                that.dialogMode = true
                that.timekeepingControl()
              }
            )
            that.sendAndroidCount()
          }
上一篇 下一篇

猜你喜欢

热点阅读