微信小程序webview上添加按钮

一、实图如下

如果你的设计稿为下图需要添加两个按钮实际引入h5页面却始终实现不了效果,那你有救了。
在这里插入图片描述

二、官方文档的webview官方api

1、铺满整个屏幕,不支持自定义导航。
2、不能设置宽高,直接铺满整个页面,一个页面只能有一个webview
3、层级极高,不能通过z-index改变元素属性来浮在上面。

在这里插入图片描述

三、解决办法 官方api只有真机才能实现效果,微信开发者工具不适用

html

<web-view src="https://720yun.com/t/a9cjvOsnOa3?scene_id=20949466">
		<cover-view class="share-button">
			<cover-view class="share-txt" >
				搭配详情
			</cover-view>
			<cover-view class="share-txt">
				商品列表
			</cover-view>
		</cover-view>
	</web-view>
	

css


.share-button {
  z-index: 999999;
  position: fixed;
  color: white;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  bottom:30rpx;
  width:60%;
  height: 72rpx;
  display: flex;
  left: 20%;
  justify-content: center;
}

.share-txt{
  width:200rpx;
height:72rpx;
box-shadow:0rpx 4rpx 6rpx 0rpx rgba(18,46,102,0.5);
border-radius:36rpx;
line-height: 72rpx;
text-align: center;
font-size: 28rpx;

}

.share-txt{
  margin-right: 40rpx;
}

评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值