uniapp跳转webview后H5不执行UniAppJSBridgeReady 回调无用

开始时我在真机上测试使用

<web-view :src="‘/hybrid/html/pages/index/index.html?userInfo=‘+JSON.stringify(userInfo)+‘&type=‘+webViewType" @message="getMessage"></web-view>

这种形式传参时没有问题会走UniAppJSBridgeReady 回调但是,离线打包生成app资源在xcode上运行到手机出现不回调

因为官方的demo实例中没有出现问题,因为里面没有向webview传参

后来发现是传参问题,不能用下面形式

<web-view :src="‘/hybrid/html/pages/index/index.html?userInfo=‘+JSON.stringify(userInfo)+‘&type=‘+webViewType" @message="getMessage"></web-view>

我改后的
<template>
    <view>
        <!-- <web-view :src="‘/hybrid/html/pages/index/index.html?userInfo=‘+JSON.stringify(userInfo)+‘&type=‘+webViewType" @message="getMessage"></web-view> -->
        <web-view :src="url" @message="getMessage"></web-view>
    </view>
</template>

<script>
    //非父子组件传值
    import bus from ../../static/js/bus.js;
    import { mapState,mapMutations } from vuex;
    export default {
        computed: mapState([userInfo,api,webViewType]),data() {
            return {
                url:‘‘,fileList:[]
            }
        },onLoad(option) {
            console.log(this.webViewType)
            this.url=`/hybrid/html/pages/index/index.html?type=${this.webViewType}&token=${this.userInfo.token}`
        },methods: {
            getMessage(event) {
                this.fileList=event.detail.data[0].fileList
                bus.$emit(fileList,this.fileList)
            }
        }
    }
</script>

<style>
</style>

就可以触发了

相关文章

咱们国内现在手机分为两类,Android手机与苹果手机,现在用的...
前言 上一篇做了php的微信登录,所以也总结一下Java的微信授...
前言 上一篇文章写到如何上架IOS应用到Appstore,其中漏掉了...
文件-新建-1.项目 ┌─uniCloud 云空间目录,阿里云为uniClo...
Flexbox #Flex 容器 Flex 是 Flexible Box 的缩写,意为&...
globalStyle 用于设置应用的状态栏、导航条、标题、窗口背景...