使用web-view向h5传参


主应用通过url给内嵌h5传参

 <web-view src="http://xxxxxxxxxx/?Id=1111"></web-view>

 

h5页面通过路径获取参数:

        onLoad() {
            this.getQueryString()
        },
        onShow() {
            this.getQueryString()
        },
        methods: {
            // 通过路径获取参数
            getQueryString()  {
                var Url=window.location.href  //h5页面获取当前页面url路径
                var str=Url.split('?')[1]||''
                var Id=str.split('=')[1]||''
                console.log(Url)
                console.log(Id) //Id就是web-view通过url传过来的值
            }

  }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM