使用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传过来的值
            }

  }
原文地址:https://www.cnblogs.com/Intellectualscholar/p/15262321.html