wx-open-launch-weapp 样式设置调试非常麻烦,所以建议用绝对布局占满需要点击的区域;
具体实现代码:
提供几个类型的示例
示例代码1:列表
<view class="list">
<view class="" v-if="historyList.length>0" v-for="(item,idx) in historyList">
<view class="listItem" style="position: relative">
<view class="p_r listItemm" style="padding: 20rpx;z-index: 1;" @click="nav_live(item.id,item)">
<image class="itemImg" :src="item.icon_img_src" mode=""></image>
<view class="itemR">
<view class="listTitle">
{{item.name}}
</view>
<view class="date">
{{$util.timeToDate(item.start)}}
</view>
<view class="p_r seeNum">
<image class="see" :src="see"></image>
<view class="mun">
{{item.pv||0}}
</view>
</view>
</view>
</view>
<wx-open-launch-weapp style="position: absolute;z-idnex:999; top: 0, left: 0;bottom:0;right:0;width: 100%;height: 100%; opacity: 0.3; background: blue" v-if="item.appid" id="launch-btn" :path="item.pagepath" :username="item.appid">
<script type="text/wxtag-template">
<div style="position: absolute;z-idnex:999; top: 0, left: 0;bottom:0;right:0;width: 100%;height: 100%; opacity: 0.3; background: red" />
</script>
</wx-open-launch-weapp>
</view>
</view>
</view>
示例代码2:轮播图
<swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
:duration="duration">
<swiper-item v-for="(item,index) in abs">
<view v-if="item.appid" class="image" @click="nav_live(item.event_room_id,item,'abs')"
:style="{backgroundImage: 'url('+item.url+')', backgroundSize:'100%', position:'relative'}">
<wx-open-launch-weapp style="position: absolute; top: 0, left: 0;bottom:0;right:0;width: 100%;height: 100%; opacity: 0.3" v-if="item.appid" id="launch-btn" id="launch-btn" :path="item.pagepath" :username="item.appid">
<script type="text/wxtag-template">
<div style="position: absolute; top: 0, left: 0;bottom:0;right:0;width: 100%;height: 100%; opacity: 0.3;" />
</script>
</wx-open-launch-weapp>
</view>
<image v-else class="image" :src="item.url" @click="nav_live(item.event_room_id,item,'abs')"></image>
</swiper-item>
</swiper>
示例代码3:按钮
<view class="orderBtn" v-show="item.is_join==1" @click="enroll(item,idx)"
:class="item.liveStartStatus==1?'btn1':'btn2'">
<wx-open-launch-weapp id="launch-btn" :username="item.appid" :path="item.pagepath">
<script type="text/wxtag-template">
<style>.btn { width: 100%;height: 100%;font-size:13px;color: #fff;line-height: 25px; }</style>
<div class="btn">{{item.btnTxt}}</div>
</script>
</wx-open-launch-weapp>
</view>