如图,刚刚小程序入门,没学多久,js也没啥基础,问问大佬们这个该如何是好
js中如何在data中访问properties中的数据?How to access data in properties in data in js?
js中如何在data中访问properties中的数据?如图,刚刚小程序入门,没学多久,js也没啥基础,问问大佬们这个该如何是好
As shown in the figure, I just started the small program. I haven't learned it for a long time, and JS has no foundation. Ask the big guys what to do about it
回答:
Component({ properties: {..............}, data: { tabs: [] }, observers: { 'tab1, tab2, tab3, tab4': function(tab1, tab2, tab3, tab4) { this.setData({ tabs: [{ value: tab1 },{ value: tab2 },{ value: tab3 },{ value: tab4 }] }) } }})// 基础库版本 2.6.1 开始支持
// 基础库版本 2.6.1 开始支持Component({ properties: {..............}, data: { tabs: [] }, observers: { 'tab1, tab2, tab3, tab4': function(tab1, tab2, tab3, tab4) { this.setData({ tabs: [{ value: tab1 },{ value: tab2 },{ value: tab3 },{ value: tab4 }] }) } }})