<!-- 可跳转小程序的标签 设置为透明 层级 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>
wx-open-launch-weapp在uni-app中的使用技巧
最新推荐文章于 2024-05-13 15:01:29 发布