javascript - How to get the value selected by the radio in the applet
迷茫
迷茫 2017-05-19 10:13:59
0
1
1130

How to get the value of the selected radio in the mini program. The following is my code. Three swipers are used to carry three questions. After selecting the three questions, the selection result pops up. How to implement it

/!-- index.wxml -->   第一题 第二题 第三题                                // index.js var app = getApp() Page({ data: { /** * 页面配置 */ winWidth: 0, winHeight: 0, // tab切换 currentTab: 0, value: [] }, onLoad: function() { var that = this; /** * 获取系统信息 */ wx.getSystemInfo({ success: function(res) { that.setData({ winWidth: res.windowWidth, winHeight: res.windowHeight }); } }); }, /** * 滑动切换tab */ bindChange: function(e) { var that = this; that.setData({ currentTab: e.detail.current }); }, /** * 点击radio切换 */ swiperChange: function(e){ var that = this; var radioValue = e.detail.value; that.setData({ value : radioValue }) console.log(that.data.value); if(that.data.currentTab>=2){ wx.navigateTo({ url: '../page3/page3', }); }else{ that.setData({ currentTab: that.data.currentTab + 1 }); } } }) /* index.wxss */ .swiper-tab{ width: 100%; border-bottom: 2rpx solid #777777; text-align: center; line-height: 80rpx; } .swiper-tab-list{ float: left; font-size: 30rpx; width: 100%; color: #777777; display: none; } .on{ color: #da7c0c; border-bottom: 5rpx solid #da7c0c; display: block; } .swiper-box{ display: block; height: 100%; width: 100%; overflow: hidden; } .swiper-box view{ text-align: center; } radio{ display: none; } .option{ border: 1px solid #ffe131; display: block; text-align: center; margin: 10% auto; width: 80%; }
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all (1)
大家讲道理

Official demo

  
Page({ data: { items: [ {name: 'USA', value: '美国'}, {name: 'CHN', value: '中国', checked: 'true'}, {name: 'BRA', value: '巴西'}, {name: 'JPN', value: '日本'}, {name: 'ENG', value: '英国'}, {name: 'TUR', value: '法国'}, ] }, radioChange: function(e) { console.log('radio发生change事件,携带value值为:', e.detail.value) } })
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!