微信小程序按鈕巧妙用法
??button 按鈕的基本使用
按鈕組件
功能比 HTML 中的 button 按鈕豐富
通過 open-type 屬性可以調(diào)用微信提供的各種功能(客服、轉(zhuǎn)發(fā)、獲取用戶授權(quán)、獲取用戶信息等)
通過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>
??各種神奇的按鈕
去這里找按鈕的樣式,然后復(fù)制:
Buttons - copy CSS & HTML! (uiverse.io)


WXML:(大家到時候需要改一改,因為我直接復(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)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- 微信小程序?qū)崿F(xiàn)可拖動懸浮圖標(biāo)(包括按鈕角標(biāo)的實現(xiàn))
- 微信小程序?qū)㈨撁姘粹o懸浮固定在底部的實現(xiàn)代碼
- 微信小程序點(diǎn)擊按鈕動態(tài)切換input的disabled禁用/啟用狀態(tài)功能
- 微信小程序中的video視頻實現(xiàn) 自定義播放按鈕、封面圖、視頻封面上文案
- 微信小程序?qū)崿F(xiàn)單個卡片左滑顯示按鈕并防止上下滑動干擾功能
- 微信小程序批量監(jiān)聽輸入框?qū)Π粹o樣式進(jìn)行控制的實現(xiàn)代碼
- 微信小程序 多行文本顯示...+顯示更多按鈕和收起更多按鈕功能
- 微信小程序按鈕點(diǎn)擊動畫效果的實現(xiàn)
- 操作按鈕懸浮固定在微信小程序底部的實現(xiàn)代碼
- 詳解微信小程序膠囊按鈕返回|首頁自定義導(dǎo)航欄功能
- 微信小程序mpvue點(diǎn)擊按鈕獲取button值的方法
- 微信小程序單選radio及多選checkbox按鈕用法示例
- 微信小程序開發(fā)之點(diǎn)擊按鈕退出小程序的實現(xiàn)方法
相關(guān)文章
js檢測標(biāo)題與描述中的關(guān)鍵詞發(fā)現(xiàn)就替換或跳轉(zhuǎn)到別的頁面
這篇文章主要介紹了js檢測標(biāo)題與描述中的關(guān)鍵詞發(fā)現(xiàn)就替換或跳轉(zhuǎn)到別的頁面的實現(xiàn)方法,主要是分享它的編程思路與加密方法2021-06-06
關(guān)于onScroll事件在IE6下每次滾動觸發(fā)三次bug說明
今天測試發(fā)現(xiàn)IE6下用window.onscroll,每次滾動時會觸發(fā)3次,而火狐、IE7沒此問題,應(yīng)該是IE6的一個BUG2011-09-09
layui-tree實現(xiàn)Ajax異步請求后動態(tài)添加節(jié)點(diǎn)的方法
今天小編就為大家分享一篇layui-tree實現(xiàn)Ajax異步請求后動態(tài)添加節(jié)點(diǎn)的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-09-09

