wx-open-launch-weapp在uni-app中的使用技巧

<!-- 可跳转小程序的标签 设置为透明 层级 100 -->
<!-- username-小程序原始id -->
<wx-open-launch-weapp username="gh_123456789abc" path="/pages/index/index">
	<script type="text/wxtag-template">
		<view>
			<view>   </view><!-- 中间为占位符 -->
			<view>   </view>
		</view>
	</script>
</wx-open-launch-weapp>

<!-- 可定义的文本内容 定位到跳转标签位置上 层级-100 -->
<view class="item">
	<view class="item_title">标题</view>
	<view class="item_img">
		<image src="a.img"></image>
	</view>
</view>
<script>
	created() {
		// #ifdef H5
			this.getwxInfo()
		// #endif
	},
	methods: {
	// #ifdef H5
		getwxInfo() {
			Api().then(res => { //获取微信公共参数
				console.log(res);
				var data = res.data;
				wx.config({
					debug: false, 
					appId: 'wx1155565548164', // 必填,公众号的唯一标识,填自己的!
					timestamp: 0, // 必填,生成签名的时间戳,刚才接口拿到的数据
					nonceStr: data.nonceStr, // 必填,生成签名的随机串
					signature: data.signature, // 必填,签名,见附录1
					jsApiList: data.jsApiList,
					openTagList: data.openTagList // 跳转小程序时必填
				});
				wx.ready(res => {
					console.log(res);
				});
				wx.error(res => {
					console.log(res);
				});
			}).catch(err => {
				console.log(err);
				
			});
		},
	}
	// #endif
</script>

微信官方文档

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值