当前位置:网站首页>微信小程序之改变数组中某值,对象中某值的方法
微信小程序之改变数组中某值,对象中某值的方法
2022-04-23 05:52:00 【幽幽靖】
1、更改数组中的值
paraList: [
{
txt:'123',chose:false},
{
txt:'1234',chose:false}
]
let choseChange = "paraList[" + index + "].chose"
this.setData({
[choseChange]: true
})
注意:选定数组的字符串不用写 this.data. !!!
可以改变数组中某一个特定下标的值
2、更改对象中的值
navbarData: {
isfixed: false,
iswhite: false, //icon color
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
title: '客户列表', //导航栏 中间的标题
backgroundcolor: '#fff',
isintercept: false, //返回拦截
},
let title = 'navbarData.title'
this.setData({
[title]: '组员客户',
})
版权声明
本文为[幽幽靖]所创,转载请带上原文链接,感谢
https://blog.csdn.net/ws19900201/article/details/108641867
边栏推荐
猜你喜欢
汇编 32位无符号加法计算器
进程管理命令
HDU-Tunnel Warfare
深蓝学院激光slam理论与实践 -第二章(里程计标定)作业
PN结、二极管原理详解与应用
[UDS unified diagnosis service] i. diagnosis overview (2) - main diagnosis protocols (K-line and can)
[UDS unified diagnostic service] II. Network layer protocol (2) - data transmission rules (single frame and multi frame)
Introduction to nonparametric camera distortion model
Makefile基础、常用函数及通用Makefile
QT icon application
随机推荐
Using printf in MFC
日志写法(带时间)
Set up a personal blog of jpress
[UDS unified diagnostic service] i. overview of diagnosis (4) - basic concepts and terms
POJ-The Unique MST
Krypton zeal
Vs can be compiled, but there will be a red underline to indicate the problem of undefined identifiers
JS高频面试题
信息学一本通-小球
基于VGG卷积神经网络的图像识别代码实现
C语言进阶要点笔记4
【UDS统一诊断服务】一、诊断概述(1)— 诊断概述
VHDL-任意分频器(50%占空比)
监听除某元素之外点击事件
深蓝学院激光slam 理论与实践 第三章激光雷达去畸变 作业习题
C语言结构体指定初始化
Generate random number
CUDA project encountered a series of compilation problems after changing the environment (computer)
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
Matching between class template with default template argument and template parameter