【button】 按钮组件说明
生活随笔
收集整理的這篇文章主要介紹了
【button】 按钮组件说明
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
原型:
<buttonsize="[default | mini]"type="[primary | default | warn]"plain="[Boolean]"disabled="[Boolean]"loading="[Boolean]"form-type="[submit | reset]"open-type="[contact | share | getUserInfo | getPhoneNumber | launchApp | openSetting | feedback]"hover-class="[String]"hover-stop-propagation="[Boolean]"hover-start-time="[Number]"hover-stay-time="[Number]"lang="[zh_CN | zh_TW | en]"bindgetuserinfo="[Handler]"session-from="[String]"send-message-title="[String]"send-message-path="[String]"send-message-img="[String]"show-message-card="[Boolean]"bindcontact="[Handler]"bindgetphonenumber="[Handler]"app-parameter="[String]"binderror="[Handler]"bindopensetting="[Handler]"> </button>?
屬性:
| 名稱 | 是否必須 | 類型 | 默認(rèn)值 | 說明 |
| size | 否 | [default | mini] | default | 按鈕大小 |
| type | 否 | [primary |?default |?warn] | default | 按鈕的樣式類型 |
| plain | 否 | [Boolean] | false | 按鈕是否鏤空,背景色透明 |
| disabled | 否 | [Boolean] | false | 是否禁用 |
| loading | 否 | [Boolean] | false | 名稱前是否帶 loading 圖標(biāo) |
| form-type | 否 | [submit | reset] | false | 用于 <form/> 組件,點(diǎn)擊分別會觸發(fā) <form/> 組件的 submit/reset 事件 |
| open-type | 否 | [contact | share | getUserInfo | getPhoneNumber | launchApp | openSetting | feedback] | ? | 微信開放能力(各參數(shù)值說明見后表) |
| hover-class | 否 | [String] | button-hover類 樣式:{background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;} | 指定按鈕按下去的樣式類。當(dāng) hover-class="none" 時(shí),沒有點(diǎn)擊態(tài)效果 |
| hover-stop-propagation | 否 | [Boolean] | false | 指定是否阻止本節(jié)點(diǎn)的祖先節(jié)點(diǎn)出現(xiàn)點(diǎn)擊態(tài) |
| hover-start-time | 否 | [Number] | 20 | 按住后多久出現(xiàn)點(diǎn)擊態(tài),單位毫秒 |
| hover-stay-time | 否 | [Number] | 70 | 手指松開后點(diǎn)擊態(tài)保留時(shí)間,單位毫秒 |
| lang | 否 | [en | zh_CN | zh_TW] | en | 返回用戶信息的語言,生效條件:open-type="getUserInfo" |
| bindgetuserinfo | 否 | [Handler] | ? | 用戶點(diǎn)擊該按鈕時(shí),會返回獲取到的用戶信息,生效條件:open-type="getUserInfo" |
| session-from | 否 | [String] | ? | 會話來源,生效條件:open-type="contact" |
| send-message-title | 否 | [String] | 當(dāng)前標(biāo)題 | 會話內(nèi)消息卡片標(biāo)題,生效條件:open-type="contact" |
| send-message-path | 否 | [String] | 當(dāng)前分享路徑 | 會話內(nèi)消息卡片點(diǎn)擊跳轉(zhuǎn)小程序路徑,生效條件:open-type="contact"? |
| send-message-img | 否 | [String]? | 截圖 | 會話內(nèi)消息卡片圖片,生效條件:open-type="contact" |
| show-message-card | 否 | [Boolean]? | false | 顯示會話內(nèi)消息卡片,生效條件:open-type="contact" |
| bindcontact | 否 | [Handler] | ? | 客服消息回調(diào),生效條件:open-type="contact" |
| bindgetphonenumber | 否 | [Handler]? | ? | 獲取用戶手機(jī)號回調(diào),生效條件:open-type="getPhoneNumber" |
| app-parameter | 否? | [String]? | ? | 打開 APP 時(shí),向 APP 傳遞的參數(shù),生效條件:open-type="launchApp"? |
| binderror? | 否? | [Handler]? | ? | 當(dāng)使用開放能力時(shí),發(fā)生錯(cuò)誤的回調(diào),生效條件:open-type="launchApp"? |
| bindopensetting | 否? | [Handler]? | ? | 在打開授權(quán)設(shè)置頁后回調(diào),生效條件:open-type="openSetting" |
?
open-type 有效值:
| 值 | 說明 |
| contact | 打開客服會話,如果用戶在會話中點(diǎn)擊消息卡片后返回小程序,可以從 bindcontact 回調(diào)中獲得具體信息 |
| share | 觸發(fā)用戶轉(zhuǎn)發(fā) |
| getUserInfo | 獲取用戶信息,可以從bindgetuserinfo回調(diào)中獲取到用戶信息 |
| getPhoneNumber | 獲取用戶手機(jī)號,可以從bindgetphonenumber回調(diào)中獲取到用戶信息 |
| launchApp | 打開APP,可以通過app-parameter屬性設(shè)定向APP傳的參數(shù) |
| openSetting | 打開授權(quán)設(shè)置頁 |
| feedback | 打開“意見反饋”頁面,用戶可提交反饋內(nèi)容并上傳日志,開發(fā)者可以登錄小程序管理后臺后進(jìn)入左側(cè)菜單“客服反饋”頁面獲取到反饋內(nèi)容 |
?
未完,待續(xù)...
更多專業(yè)前端知識,請上 【猿2048】www.mk2048.com
總結(jié)
以上是生活随笔為你收集整理的【button】 按钮组件说明的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【自定义组件】如何引用自定义组件
- 下一篇: 【WXS全局对象】Date