当前位置: 首页 > news >正文

Vant Weapp

Vant Weapp - 轻量、可靠的小程序 UI 组件库

van-radio name 是一个字符串,无法传对象的处理

以及 mpx 多层嵌套 for 循环处理

<viewwx:for="{{questionList}}"wx:for-item="question" // item 重命名wx:for-index="questionIndex" // index 重命名wx:key="question"><view wx:show="{{questionIndex + 1 === showIndex}}" class="hz-card"><text class="hz-question">{{ questionIndex + 1 }}:{{ question.question }} ({{ question.type }}类问题)</text><van-radio-groupvalue="{{ answerList[questionIndex].answerItem }}"bind:change="onChange($event, questionIndex, question.type)"direction="horizontal"><van-radio wx:for="{{question.options}}" wx:key="text" name='{{"score:" + item.score + ",text:" + item.text}}'>{{ item.text }} 
// name 给传一个类似对象的字符串</van-radio></van-radio-group></view></view>
 onChange(event, index, type) {// vant-radio 中的 name 是字符串,传不了对象,这么处理事因为有的答案不同但是得分相同const selectData = event.detail // "score:1,text:蓝"this.answerList[index].answerItem = selectDatalet score = selectData.split(",")[0].split(":")[1]; // 把 "score:1,text:蓝" 中的 score 取出来this.answerList[index].score = parseInt(score)this.answerList[index].type = type},

http://www.lryc.cn/news/307839.html

相关文章:

  • 无人机精准定位技术,GPS差分技术基础,RTK原理技术详解
  • java面试:elasticsearch
  • GO语言学习笔记(与Java的比较学习)(三)
  • 如何用Python3自撰一个简单的后端框架
  • 使用pyannote-audio实现声纹分割聚类
  • 防御保护:防火墙内容安全
  • uni-app webview 打开baidu.com
  • 【C#】SixLabors.ImageSharp和System.Drawing两者知多少
  • 总是 -bash: gomobile: 命令未找到
  • day27【LeetCode】454. 四数相加 II
  • UE5 UE4 不同关卡使用Sequence动画
  • 【JAVA日志】关于日志系统的架构讨论
  • 云计算与边缘计算:有何不同?
  • 「连载」边缘计算(二十)02-23:边缘部分源码(源码分析篇)
  • Swagger接口文档管理工具
  • 关于HTML5表单验证的方法教程
  • .NET生成MongoDB中的主键ObjectId
  • BeautifulSoup+xpath+re+css简单复习+新的scrapy的学习
  • Python爬虫实战:从API获取数据
  • 音频转换器哪个好?3款电脑软件+3款手机应用
  • 惯性导航 | 运动学---运动模型
  • Java Web(十一)--JSON Ajax
  • GL/gl.h: No such file or directory(CentOS8 QT5.12.12)
  • 【外设篇】-显示器
  • 可视化图文报表
  • CW023A-H035 CW023A-R230铜合金硬度材质书
  • Ribbon负载均衡:提升应用性能与可靠性的秘密武器(一)
  • python递归算法
  • azure devops工具实践分析
  • 2024年2月19日-2月25日(全面进行+收集免费虚幻商城资源,20小时,合计2561小时,剩余7439小时)