這篇文章主要介紹了微信小程序使用radio顯示單選項(xiàng)功能,涉及針對(duì)radio組件事件響應(yīng)相關(guān)操作技巧,并附帶源碼供讀者下載參考,需要的朋友可以參考下
本文實(shí)例講述了微信小程序使用radio顯示單選項(xiàng)功能。分享給大家供大家參考,具體如下:
1、效果展示
2、關(guān)鍵代碼
① index.wxml
<radio-group bindchange="radiogroupBindchange"> <radio value="radio1">radio1</radio> <radio value="radio2">radio2</radio> <radio value="radio3">radio3</radio> </radio-group> <view>提示:{{text}}</view>
登錄后復(fù)制
② index.js
Page({ data:{ // text:"這是一個(gè)頁面" text:'' }, radiogroupBindchange:function(e){ console.log(e); this.setData({ text:'您選擇了'+e.detail.value }) } })
登錄后復(fù)制
3、源代碼
關(guān)于radio組件的更多詳細(xì)說明還可參考官網(wǎng):
以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,更多相關(guān)內(nèi)容請關(guān)注PHP中文網(wǎng)!
相關(guān)推薦:
以上就是微信小程序使用radio顯示單選項(xiàng)功能【附源碼】的詳細(xì)內(nèi)容,更多請關(guān)注有卡有網(wǎng)。