当前位置:网站首页>Do not update the sub component page of parameter object passed from parent to child of nailing applet?
Do not update the sub component page of parameter object passed from parent to child of nailing applet?
2022-06-13 08:08:00 【Dark_ programmer】
When developing nailing applet , When I come across such a problem .
The... Passed from the parent to the child Values are arrays
, Parent component passed setData to update
Value time subcomponent No changes in data were detected
The previous usage is as follows :
The parent component uses the child component :
<Child list='{
{arrayList}}'/>
The parent component updates the data :
data:{
arrayList:[]
}
...
const newList = [1, 2, 3, 4, 5, 6]
this.setData({
arrayList: newList
})
The child component receives the parent component data and stores it in itself data In order to use
The subcomponent receives parameters :
data:{
list: []
}
...
this.setData({
list: this.props.list
})
Use of subcomponents :
<view a:for="{
{list}}">
{
{item}}
</view>
After trying , It is modified to use the parent component directly props The data in
Modify the usage as follows :
The subcomponent receives parameters :
props: {
list: ()=>Object;
}
Use of subcomponents :
<view a:for="{
{list}}">
{
{item}}
</view>
边栏推荐
猜你喜欢
1. fabric2.2 comprehensive learning - Preface
Practice makes sense -- your byte alignment and stack cognition may be wrong
Get properties of class
JMeter UDP pressure measurement
钉钉小程序如何隐藏tab
SolidWorks修改工程图中文字字体的方法
ES6 deleting an attribute of an object
26 | superscalar and VLIW: how to make the CPU throughput exceed 1
Overall process analysis of account book operation in fabric0.6
25 | 冒险和预测(四):今天下雨了,明天还会下雨么?
随机推荐
20 | pipeline oriented instruction design (Part 1): Modern CPU with multi-purpose
2022年危险化学品经营单位安全管理人员特种作业证考试题库及模拟考试
19 | establish data path (bottom): instruction + operation =cpu
Disk C is full? A few simple tips teach you to release and clean up tens of gigabytes of space on the C disk, the most effective way to clean up the C disk
4. fabric2.2 create and join channels (use the official demo)
批发商为什么要使用订单系统
25 | adventure and prediction (IV): it's raining today. Will it rain tomorrow?
BD新标签页(BdTab)插件如何登入?
Get properties of class
赋予代码生命力--读代码整洁之道
26 | Superscalar和VLIW:如何让CPU的吞吐率超过1
18 | establish data path (middle): instruction + operation =cpu
Openharmony notes ----------- (I)
Amino encoding protocol
Data warehouse data processing and data flow
Clickhouse column basic data type description
【PYTORCH】RuntimeError: one of the variables needed for gradient computation has been
Edge浏览器如何安装BdTab(BD)新标签页插件(图文教程)
安装CUDA+CUSP环境,并创建第一个HelloWord入门工程
17 | establish data path (upper): instruction + operation =cpu