uniapp微信小程序使用<web-view :src=“url“></web-view>携带参数

web-view页面

<template>
	<view>
		<web-view :src="url"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		onLoad(option) {
			this.url = decodeURIComponent(option.url);
			console.log('option',decodeURIComponent(option.url))
		},
	}
</script>

跳转方法

navto(value) { //value为携带参数的url地址
				const url = '/页面路径/web-view?url='+encodeURIComponent(value)
				
				uni.navigateTo({
					url: url
				})
			},

encodeURIComponent和decodeURIComponent非常重要,不用的话跳转网页?xxx=xxx的参数会携带不上

猜你喜欢

转载自blog.csdn.net/qq_54994255/article/details/142482246