uniapp APP使用applinks 唤起APP 并传参

由appA唤起appB并传参

appA的代码( https://xxx.xxx.com是appB的applinks)

注意传参内容不支持汉字,所以如果有汉字需要encodeUrl转义一下

// #ifdef APP-PLUS
			plus.runtime.openURL('https://xxx.xxx.com?account=123 ', error => {
				uni.showModal({
					title: '失败',
					content: JSON.stringify(error),
					success: data => {}
				});
			});
// #endif

appB接收参数并做对应的处理(我是 跳转到指定页面)

app.vue

onShow() {
// #ifdef APP-PLUS
// 检测启动参数
		plus.globalEvent.addEventListener('newintent', e => {
			if (plus.runtime.arguments) {
				var data = plus.runtime.arguments;
				var res= data.split('?');
				uni.navigateTo({
					url: '/pages/xxx/xxx?' +res[1]
				});
			}
		});
		// #endif
}

你可能感兴趣的:(vue.js,前端,javascript)