wx-open-launch-weapp 样式问题

本文介绍了在微信小程序中使用wx-open-launch-weapp组件时,由于样式调试困难,建议采用绝对布局填充点击区域以优化用户体验。提供了列表、轮播图和按钮三种类型的示例代码,展示如何设置样式以确保点击区域覆盖内容,并通过透明层增强点击反馈。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

a_靖

对你有帮助吗?打赏鼓励一下?

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值