美文网首页
H5 调安卓这边写法

H5 调安卓这边写法

作者: 如果俞天阳会飞 | 来源:发表于2019-11-23 13:56 被阅读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()
          }

相关文章

网友评论

      本文标题:H5 调安卓这边写法

      本文链接:https://www.haomeiwen.com/subject/jdrhwctx.html