微信小程序按鈕巧妙用法
??button 按鈕的基本使用
按鈕組件
功能比 HTML 中的 button 按鈕豐富
通過 open-type 屬性可以調(diào)用微信提供的各種功能(客服、轉(zhuǎn)發(fā)、獲取用戶授權、獲取用戶信息等)
通過type屬性指定按鈕顏色類型
WXML:
<!-- 通過type屬性指定按鈕顏色類型 --> <button>普通按鈕</button> <button type="primary">主色調(diào)</button> <button type=warn">警告</button>
注:后期會對按鈕添加事件,現(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>
??各種神奇的按鈕
去這里找按鈕的樣式,然后復制:
Buttons - copy CSS & HTML! (uiverse.io)
WXML:(大家到時候需要改一改,因為我直接復制上面 按鈕樣式 里面的代碼)
<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; }
下期預告:image 組件的基本使用
到此這篇關于微信小程序按鈕巧妙用法的文章就介紹到這了,更多相關微信小程序按鈕內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
- 微信小程序?qū)崿F(xiàn)可拖動懸浮圖標(包括按鈕角標的實現(xiàn))
- 微信小程序?qū)㈨撁姘粹o懸浮固定在底部的實現(xiàn)代碼
- 微信小程序點擊按鈕動態(tài)切換input的disabled禁用/啟用狀態(tài)功能
- 微信小程序中的video視頻實現(xiàn) 自定義播放按鈕、封面圖、視頻封面上文案
- 微信小程序?qū)崿F(xiàn)單個卡片左滑顯示按鈕并防止上下滑動干擾功能
- 微信小程序批量監(jiān)聽輸入框?qū)Π粹o樣式進行控制的實現(xiàn)代碼
- 微信小程序 多行文本顯示...+顯示更多按鈕和收起更多按鈕功能
- 微信小程序按鈕點擊動畫效果的實現(xiàn)
- 操作按鈕懸浮固定在微信小程序底部的實現(xiàn)代碼
- 詳解微信小程序膠囊按鈕返回|首頁自定義導航欄功能
- 微信小程序mpvue點擊按鈕獲取button值的方法
- 微信小程序單選radio及多選checkbox按鈕用法示例
- 微信小程序開發(fā)之點擊按鈕退出小程序的實現(xiàn)方法
相關文章
JavaScript獲取鼠標移動時的坐標(兼容IE8、chome谷歌、Firefox)
這篇文章主要介紹了JavaScript獲取鼠標移動時的坐標(兼容IE8、chome谷歌、Firefox瀏覽器),需要的朋友可以參考下2014-09-09TypeScript工具類 Partial 和 Required 的場景分析
這篇文章主要介紹了TypeScript工具類 Partial 和 Required 的詳細講解,本文通過場景描述給大家詳細講解工具類的使用,結(jié)合實例代碼給大家介紹的非常詳細,需要的朋友可以參考下2022-09-09省市區(qū)三級聯(lián)動下拉框菜單javascript版
這篇文章主要給大家介紹了javascript實現(xiàn)省市區(qū)三級聯(lián)動下拉框菜單,有需要的朋友可以參考下2015-08-08