button组件的open-type设置为getPhoneNumber,点击时想先走一下本地逻辑?

小程序 文章 2021-04-02 15:02 3624 0 全屏看文

AI助手支持GPT4.0

button组件的open-type设置为getPhoneNumber,点击时想先走一下本地逻辑?The open-type of the button component is set to getPhoneNumber, do you want to go through the local logic when you click it?

button组件的open-type设置为getPhoneNumber,点击时想先走一下本地逻辑?

有一个需求,在用户点击立即登录按钮之前,应该判断一下该用户是否已经同意平台使用条款。但是点击按钮之后会直接获取用户电话信息之类的数据,可能用户没有勾选同意平台使用条款也会弹框。疑问就是能不能在点击后先做一件事情然后再确定是否弹框。例如在用户没勾选同意平台使用条款的时候弹窗提示需要同意。

具体请看图:

There is a need to judge whether the user has agreed to the terms of use of the platform before the user clicks the login now button. However, after you click the button, you will directly obtain data such as the user's phone information. Maybe the user does not check "agree" to the terms of use of the platform, and the box will pop up. The question is whether you can do something after clicking, and then determine whether to pop the box. For example, when the user does not check agree to the terms of use of the platform, the pop-up prompt needs to agree. Please refer to the figure for details

回答:

brave:
<button open-type="{{isAgree ? 'getPhoneNumber' : ''}}" bindgetphonenumber="onGetPhoneNumber">授权获取手机号</button>
peng:

简单点:open-type的值用字段控制,默认是空,选中同意是=getPhoneNumber,去掉反之。

Brother斌🎈:

直接在立即登录上面悬浮一个透明的按钮,勾选条款隐藏,否则显示不就行了

咕噜将军:我试下,好思路。感谢!
brave:这样做就有点麻烦了
Brother斌🎈:确实 我项目里就是你那种写法的 没想到第一感觉居然是悬浮按钮....

-EOF-

AI助手支持GPT4.0