当前位置:网站首页>Wechat applet change attribute value -setdata- bidirectional binding -model
Wechat applet change attribute value -setdata- bidirectional binding -model
2022-07-29 05:39:00 【Program ape runs forward】
How to change the properties of an array and object ?
1、 Change the value in the array
set up paraList:[{
txt:'123',chose:false},{
txt:'1234',chose:false}]
let choseChange = "paraList[" + index + "].chose"
_this.setData({
[choseChange]: true,
numList: numList
})
You can change the value of a specific subscript in the array
2、 Change the value in the object
userInfo: {
// User authentication information
sex: '',
name: '',
phone: '',
code: '',
sexTxt:' Please choose your gender ',
nameTxt:' Name cannot be empty ',
phoneTxt: ' Cell phone number cannot be empty ',
codeTxt: ' Get verification code ',
codeErrTxt:' Verification code cannot be empty '
},
let userSex = "userInfo.sex"
_this.setData({
[userSex]: '1'
})
Can be changed separately userInfo Medium sex value
(1) In non custom components
<input model:value="{
{ attribute }}" />
I won't support it data in . The way of writing path
Such as :<input model:value="{
{ a.b }}" />
(2) Custom components Components in
1、 Define the format of the passed in attribute
Component({
properties: {
myValue: String
}
})
2、 Used in components
<input model:value="{
{myValue}}" />
3、 Where this component is referenced
<custom-component model:my-value="{
{ attribute }}" /> my-value Can be any field , In the component, it should be written in the form of hump
https://blog.csdn.net/Shids_/article/details/125538656
边栏推荐
- Alibaba cloud and Dingjie software released the cloud digital factory solution to realize the localized deployment of cloud MES system
- ClickHouse学习(八)物化视图
- 重绘与回流的关系
- Redirection and files
- js深拷贝-笔记
- [C language series] - storage of deep anatomical data in memory (II) - floating point type
- 微信小程序更改属性值-setData-双向绑定-model
- Occt learning 003 - MFC single document project
- 微信小程序-屏幕高度
- 利用Poi-tl在word模板表格单元格内一次插入多张图片和多行单元格相同数据自动合并的功能组件
猜你喜欢

365 day challenge leetcode1000 question - day 036 binary tree pruning + subarray and sorted interval sum + delete the shortest subarray to order the remaining arrays

·Let's introduce ourselves to the way of programming·

用threejs 技术做游戏跑酷

ClickHouse学习(九)clickhouse整合mysql

C language first level pointer

Best practices for elastic computing in the game industry

uniapp之常用提示弹框

Day 2

Detailed installation and use tutorial of MySQL (nanny installation with pictures and texts)

ClickHouse学习(四)SQL操作
随机推荐
【C语言系列】— 一道递归小题目
无重复字符的最长字串
uniapp组件之tab选项卡滑动切换
常见特征工程操作
[event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises
Introduction to array learning simple question sum of two numbers
微信小程序更改属性值-setData-双向绑定-model
【无标题】
Do students in the science class really understand the future career planning?
C language n queen problem
ANSI C type qualifier
[C language series] - detailed explanation of file operation (Part 1)
Allocate memory: malloc() and free()
ClickHouse学习(九)clickhouse整合mysql
2022 mathematical modeling competition summer training lecture - optimization method: goal planning
HCIA-R&S自用笔记(27)综合实验
Cmu15-213 shell lab experiment record
shell基本操作(下)
365 day challenge leetcode1000 question - day 036 binary tree pruning + subarray and sorted interval sum + delete the shortest subarray to order the remaining arrays
第三课threejs全景预览房间案例