微信小程序(十九)radio組件詳細(xì)介紹

radio組件為單選組件與radio-group組合使用,使用方式和checkbox沒(méi)啥區(qū)別
主要屬性:


wxml
<!--設(shè)置監(jiān)聽(tīng)器,當(dāng)點(diǎn)擊radio時(shí)調(diào)用-->
<radio-group bindchange="listenerRadioGroup">
<!--label通常與radio和checkbox結(jié)合使用-->
<label style="display: flex" wx:for-items="{{array}}">
<radio value="{{item.name}}" checked="{{item.checked}}"/>{{item.value}}
</label>
</radio-group>
js
Page({
data:{
array:[
{name: 'Jave', value: 'Android', checked: 'true'},
{name: 'Object-C', value: 'IOS'},
{name: 'jsx', value: 'ReactNative'},
{name: 'js', value: 'WeChat'},
{name: 'Python', value: 'Web'},
]
},
/**
* radio監(jiān)聽(tīng)事件
*/
listenerRadioGroup:function(e) {
console.log(e);
},
onLoad:function(options){
// 頁(yè)面初始化 options為頁(yè)面跳轉(zhuǎn)所帶來(lái)的參數(shù)
},
onReady:function(){
// 頁(yè)面渲染完成
},
onShow:function(){
// 頁(yè)面顯示
},
onHide:function(){
// 頁(yè)面隱藏
},
onUnload:function(){
// 頁(yè)面關(guān)閉
}
})
相關(guān)文章:
hello WeApp icon組件
Window text組件 switch組件
tabBar底部導(dǎo)航 progress組件 action-sheet
應(yīng)用生命周期 button組件 modal組件
頁(yè)面生命周期 checkbox組件 toast組件
模塊化詳 form組件詳 loading 組件
數(shù)據(jù)綁定 input 組件 navigator 組件
View組件 picker組件 audio 組件
scroll-view組件 radio組件 video組件
swiper組件 slider組件 Image組件
相關(guān)文章
ant-design的upload組件中實(shí)現(xiàn)粘貼上傳實(shí)例詳解
這篇文章主要為大家介紹了ant-design的upload組件中實(shí)現(xiàn)粘貼上傳實(shí)例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-05-05
JS數(shù)據(jù)分析數(shù)據(jù)去重及參數(shù)序列化示例
這篇文章主要為大家介紹了JS數(shù)據(jù)分析數(shù)據(jù)去重及參數(shù)序列化示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-08-08
幫你提高開(kāi)發(fā)效率的JavaScript20個(gè)技巧
JavaScript確實(shí)是一門(mén)很好的開(kāi)發(fā)語(yǔ)言。對(duì)于給定的問(wèn)題,可以有不止一種方法來(lái)達(dá)到相同的解決方案。在這篇文章中,我們將討論最快速的方法2021-06-06
JS前端實(shí)現(xiàn)fsm有限狀態(tài)機(jī)實(shí)例詳解
這篇文章主要為大家介紹了JS前端實(shí)現(xiàn)fsm有限狀態(tài)機(jī)實(shí)例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-09-09
js 實(shí)現(xiàn)驗(yàn)證碼輸入框示例詳解
這篇文章主要為大家介紹了js 實(shí)現(xiàn)驗(yàn)證碼輸入框示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-09-09

