给BTN加一个本地背景
带open-type的BTN因为没法用bindtap的image代替,所以需要加一个背景CSS,但不支持本地图片,所以,所以在按钮后面叠加一个IMAGE,通过POSITION=absulte来叠加。
<view class="placeholder" style="width:50vw;height:40vw" >
<button
type="default"
open-type="contact"
bindcontact="handleContact"
show-message-card="{{true}}"
send-message-title="咨询"
style="width: 100%;height: 40vw;position: absolute; z-index:2;background-color: transparent;">
</button>
<image
mode="widthFix"
src="../../images/serv.png"
style="width: 50vw;position: absolute;z-index: 1;">
</image>
</view>
另一种级BTN加背景的方式
<button class="btn"></button>
.btn::after {
border: none;
background-image: url('https://res.groooo.com/yaj_home_btn_more.png');
background-size: 100%;
}