微信小程序 内 打开另一个小程序 demo

老规矩先放官方文档


上代码片段


<view class="all">
  <view class="list">
    <view class="list-item" bindtap="open_tiezhi">
      <view class="list-item-img-box">
        <image src="../../../images/tiezhimini.png"></image>
      </view>

      <view class="list-item-text">
        <view class="t1">头像贴纸加文字</view>
        <view class="t2">头像加国旗、圣诞帽、口罩</view>
      </view>

      <view class="list-item-right-box">
        <image src="../../../images/icons/right.png"></image>
      </view>

    </view>
  </view>

</view>
.list {
    
    
	padding: 20rpx;
}

.list-item {
    
    
	height: 150rpx;
	display: flex;
	flex-direction: row;
	border-radius: 5px;
	overflow: hidden;
	/* border: 1px solid #ededed; */

	box-shadow: 1px 1px 5px #ededed;
	padding: 20rpx;
}

.list-item-img-box, .list-item-right-box {
    
    
	width: 150rpx;
	height: 150rpx;
	border-radius: 5px;
	overflow: hidden;
}

.list-item-right-box {
    
    
	padding: 40rpx 0rpx 40rpx 40rpx;
	height: 70rpx;
	width: 70rpx;
}

.list-item-text {
    
    
	padding: 20rpx 0rpx;
	padding-left: 20rpx;
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
}

.t1 {
    
    
	font-weight: 600;
}

.t2 {
    
    
	font-weight: 300;
	color: #bfbfbf;
}

image {
    
    
	height: 100%;
	width: 100%;
}
Page({
    
    
  data: {
    
    
  },

  open_tiezhi: function() {
    
    
    wx.navigateToMiniProgram({
    
    
      appId: 'wx6666666666666',
      success(res) {
    
    

      }
    })
  },


  onShareAppMessage: function() {
    
    

  }
})


app.json 添加以下配置 "navigateToMiniProgramAppIdList": [ "wx66666666666666" ],

无需声明跳转名单,不限跳转数量(众测中)
从2020年4月24日起,使用跳转其他小程序功能将无需在全局配置中声明跳转名单,调用此接口时将不再校验所跳转的 AppID 是否在 navigateToMiniProgramAppIdList 中。
从2020年4月24日起,跳转其他小程序将不再受数量限制,使用此功能时请注意遵守运营规范。



效果图:


在这里插入图片描述


有帮助点个赞哦 ~~~~~

猜你喜欢

转载自blog.csdn.net/u013633921/article/details/105484612