uniapp 小程序 跳转到外部链接

场景:点击“积分列表”中的“积分兑换”,需要跳转到三方的“积分商城”链接进行兑换,兑换完成后,跳回小程序“积分列表”。

结论:无法离开小程序,跳转到其他地址。只能通过web-view内嵌的形式,将三方链接内嵌进小程序。

参数传递方式:拼接到src上 ,<web-view src='https://aaa.com/index?参数a=XXXXX&参数b=XXXXX' / >

积分列表页面

<template>
	<!-- 积分列表 -->
	<view class="bg_wrap fs_28">
		<text class="cor_9 fs_24">累计积分:{{info.total}}</text>
		<text class="cor_9 fs_24">剩余积分:{{info.surplus}}</text>
		<view class="green_btn_small" @click="go_thirdPart">去兑换</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {
					total: 12,
					surplus: 1
				}
			}
		},
		methods: {
			// 去兑换
			go_thirdPart() {
				uni.navigateTo({
					url: `/subpkg/bonus/bonus_exchange?openid=${uni.getStorageSync('openid')}&surplus=${this.info.surplus}`
				})
			}˝
		}
	}
</script>

积分兑换页面

<template>
	<!-- 积分兑换页面 -->
	<view class="bg_wrap fs_28">
		<web-view
			:src="`https://cy.jingxiniao.com/index/inlet.html?openid=${options.openid}&surplus=${options.surplus}`" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				options: {}
			}
		},
		onLoad(options) {
			this.options = options
		},
	}
</script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值