微信小程序按鈕巧妙用法
??button 按鈕的基本使用
按鈕組件
功能比 HTML 中的 button 按鈕豐富
通過(guò) open-type 屬性可以調(diào)用微信提供的各種功能(客服、轉(zhuǎn)發(fā)、獲取用戶授權(quán)、獲取用戶信息等)
通過(guò)type屬性指定按鈕顏色類型
WXML:
<!-- 通過(guò)type屬性指定按鈕顏色類型 --> <button>普通按鈕</button> <button type="primary">主色調(diào)</button> <button type=warn">警告</button>
注:后期會(huì)對(duì)按鈕添加事件,現(xiàn)在只是給大家演示一下按鈕的類型
小尺寸按鈕
<button size="mini">普通按鈕</button> <button type="primary" size="mini">主色調(diào)</button> <button type=warn" size="mini">警告</button>
plain鏤空按鈕
<button plain>普通按鈕</button> <button type="primary" plain>主色調(diào)</button> <button type=warn" plain>警告</button>
??各種神奇的按鈕
去這里找按鈕的樣式,然后復(fù)制:
Buttons - copy CSS & HTML! (uiverse.io)
WXML:(大家到時(shí)候需要改一改,因?yàn)槲抑苯訌?fù)制上面 按鈕樣式 里面的代碼)
<button>
<span>Button</span>
<view class="liquid"></view>
</button>
WXSS:
/* From www.lingdaima.com */ button { position: relative; padding: 19px 36px; display: block; text-decoration: none; text-transform: uppercase; overflow: hidden; border-radius: 40px; border: none; } button span { position: relative; color: #fff; font-family: Arial; letter-spacing: 8px; z-index: 1; } button .liquid { position: absolute; top: -80px; left: 0; width: 100%; height: 200px; background: #4973ff; box-shadow: inset 0 0 50px rgba(0, 0, 0, .5); transition: .5s; } button .liquid::after, button .liquid::before { content: ''; width: 200%; height: 200%; position: absolute; top: 0; left: 50%; transform: translate(-50%, -75%); background: #fff; } button .liquid::before { border-radius: 45%; background: rgba(20, 20, 20, 1); animation: animate 5s linear infinite; } button .liquid::after { border-radius: 40%; background: rgba(20, 20, 20, .5); animation: animate 10s linear infinite; } button:hover .liquid { top: -120px; } @keyframes animate { 0% { transform: translate(-50%, -75%) rotate(0deg); } 100% { transform: translate(-50%, -75%) rotate(360deg); } }
WXML:
<button> Button </button>
WXSS:
/* From uiverse.io by @adamgiebl */ button { background: #FBCA1F; font-family: inherit; padding: 0.6em 1.3em; font-weight: 900; font-size: 18px; border: 3px solid black; border-radius: 0.4em; box-shadow: 0.1em 0.1em; } button:hover { transform: translate(-0.05em, -0.05em); box-shadow: 0.15em 0.15em; } button:active { transform: translate(0.05em, 0.05em); box-shadow: 0.05em 0.05em; }
下期預(yù)告:image 組件的基本使用
到此這篇關(guān)于微信小程序按鈕巧妙用法的文章就介紹到這了,更多相關(guān)微信小程序按鈕內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- 微信小程序?qū)崿F(xiàn)可拖動(dòng)懸浮圖標(biāo)(包括按鈕角標(biāo)的實(shí)現(xiàn))
- 微信小程序?qū)㈨?yè)面按鈕懸浮固定在底部的實(shí)現(xiàn)代碼
- 微信小程序點(diǎn)擊按鈕動(dòng)態(tài)切換input的disabled禁用/啟用狀態(tài)功能
- 微信小程序中的video視頻實(shí)現(xiàn) 自定義播放按鈕、封面圖、視頻封面上文案
- 微信小程序?qū)崿F(xiàn)單個(gè)卡片左滑顯示按鈕并防止上下滑動(dòng)干擾功能
- 微信小程序批量監(jiān)聽(tīng)輸入框?qū)Π粹o樣式進(jìn)行控制的實(shí)現(xiàn)代碼
- 微信小程序 多行文本顯示...+顯示更多按鈕和收起更多按鈕功能
- 微信小程序按鈕點(diǎn)擊動(dòng)畫(huà)效果的實(shí)現(xiàn)
- 操作按鈕懸浮固定在微信小程序底部的實(shí)現(xiàn)代碼
- 詳解微信小程序膠囊按鈕返回|首頁(yè)自定義導(dǎo)航欄功能
- 微信小程序mpvue點(diǎn)擊按鈕獲取button值的方法
- 微信小程序單選radio及多選checkbox按鈕用法示例
- 微信小程序開(kāi)發(fā)之點(diǎn)擊按鈕退出小程序的實(shí)現(xiàn)方法
相關(guān)文章
JS實(shí)現(xiàn)調(diào)用本地?cái)z像頭功能示例
這篇文章主要介紹了JS實(shí)現(xiàn)調(diào)用本地?cái)z像頭功能,結(jié)合實(shí)例形式分析了Javascript基于瀏覽器對(duì)本地硬件操作簡(jiǎn)單實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-05-05用javascript實(shí)現(xiàn)畫(huà)板的代碼
用javascript實(shí)現(xiàn)畫(huà)板的代碼...2007-09-09JavaScript獲取鼠標(biāo)移動(dòng)時(shí)的坐標(biāo)(兼容IE8、chome谷歌、Firefox)
這篇文章主要介紹了JavaScript獲取鼠標(biāo)移動(dòng)時(shí)的坐標(biāo)(兼容IE8、chome谷歌、Firefox瀏覽器),需要的朋友可以參考下2014-09-09TypeScript工具類 Partial 和 Required 的場(chǎng)景分析
這篇文章主要介紹了TypeScript工具類 Partial 和 Required 的詳細(xì)講解,本文通過(guò)場(chǎng)景描述給大家詳細(xì)講解工具類的使用,結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下2022-09-09省市區(qū)三級(jí)聯(lián)動(dòng)下拉框菜單javascript版
這篇文章主要給大家介紹了javascript實(shí)現(xiàn)省市區(qū)三級(jí)聯(lián)動(dòng)下拉框菜單,有需要的朋友可以參考下2015-08-08js編寫(xiě)一個(gè)簡(jiǎn)單的產(chǎn)品放大效果代碼
這篇文章主要為大家分享了js編寫(xiě)一個(gè)簡(jiǎn)單的產(chǎn)品放大效果代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-06-06談?wù)劄槭裁茨愕?JavaScript 代碼如此冗長(zhǎng)
這篇文章主要介紹了談?wù)劄槭裁茨愕?JavaScript 代碼如此冗長(zhǎng),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2019-01-01