button 中的 open-type开放了很多功能,请问能用事件bindtap打开吗?

小程序 文章 2021-03-07 10:01 570 0 全屏看文

AI助手支持GPT4.0

button 中的 open-type开放了很多功能,请问能用事件bindtap打开吗?The open-type in the button has opened many functions, can I open it with the event bindtap?

button 中的 open-type开放了很多功能,请问能用事件bindtap打开吗?

写好的一个图片样式,不想用按钮button打开,有办法实现吗?

想点击某个view,打开button中的开放能力open-type。

Write a good picture style, do not want to use button to open, there is a way to achieve it? You want to click a view to open the open type ability in button.

回答:

CitizenFour:

可以啊

Why not?:

这种情况我一般是用<button plain="true" style="background-image:url({{imageSrc}})"/>,再加点样式,类似这样:

{

  width: 48rpx;

  height: 48rpx;

  background-size: 48rpx 48rpx;

  background-position: 0rpx 0rpx;

  background-repeat: no-repeat;

}


brave:

除了最后一个可以使用 https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html 这个API,其他的没办法通过API直接触发。

建议:

<view class="item"></view>//改写为:<button class="item clearBtn" openType="contact"></button>//button默认样式可以清除.clearBtn {  clear: both;  margin: 0padding: 0box-sizing: inherit;  text-decoration: none;  border-radius: 0;  -webkit-tap-highlight-color: transparent;  overflow: hidden;  background: none;  cursor: pointer;  font-weight: normal;}.clearBtn::after {  border: 0box-shadow: 0;}

-EOF-

AI助手支持GPT4.0