微信小程序使用radio显示单选项功能【附源码下载】
时间:2021-03-07 10:32:23|栏目:JavaScript代码|点击: 次
本文实例讲述了微信小程序使用radio显示单选项功能。分享给大家供大家参考,具体如下:
1、效果展示

2、关键代码
① 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>
② index.js
Page({
data:{
// text:"这是一个页面"
text:''
},
radiogroupBindchange:function(e){
console.log(e);
this.setData({
text:'您选择了'+e.detail.value
})
}
})
3、源代码点击此处本站下载。
关于radio组件的更多详细说明还可参考官网:https://mp.weixin.qq.com/debug/wxadoc/dev/component/radio.html
希望本文所述对大家微信小程序开发有所帮助。
上一篇:js 完美图片新闻轮转效果,腾讯大粤网首页图片轮转改造而来
栏 目:JavaScript代码
下一篇:js form表单input框限制20个字符,10个汉字代码实例
本文标题:微信小程序使用radio显示单选项功能【附源码下载】
本文地址:http://www.codeinn.net/misctech/76142.html






