怎么给数组赋值?

小程序 文章 2022-03-14 14:00 0 全屏看文

怎么给数组赋值?How to assign a value to an array?

怎么给数组赋值?

我想给upMenuList数组赋值message里面的honor_name,语法语句怎么写,请教大佬们

I want to assign honor in message to the upmenulist array_ Name, how to write the grammar sentence? Please ask the bosses

回答:

夏:

数据类型还没弄明白?

下渝州:

如果想赋值后还是数组就

let array = this.data.upMenuList

array.push(this.data.message[0].honor_name)

this.setData({

upMenuList: array

})



.:

1,你给数组赋值一个string?

2,就算你要赋值你也是this.data.message,wx:for遍历取honor_name

-EOF-