主應用通過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傳過來的值
}
}