HarmonyOS TextPicker怎么支持深度为3的树的显示?

树整体上都是深度都是3,只有部分分支,深度只有2,这种怎么显示呢?

{  
  text: '辽宁省',  
  children: [{ text: '沈阳市', children: [{ text: '沈河区' }, { text: '和平区' }, { text: '浑南区' }] },  
    { text: '大连市', children: [{ text: '中山区' }, { text: '金州区' }, { text: '长海县' }] }]  
},  
{  
  text: '吉林省',  
  children: [{ text: '长春市', children: [{ text: '南关区' }, { text: '宽城区' }, { text: '朝阳区' }] },  
    { text: '四平市' }]  
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
HarmonyOS
2024-10-21 09:49:26
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
FengTianYa

如下可以正常运行:

class bottom {  
  bottom:number = 50  
}  
let bott:bottom = new bottom()  
@Entry  
@Component  
struct TextPickerExample {  
  private cascade: TextCascadePickerRangeContent[] = [{  
    "text": "别墅",  
    "children": [  
      {"text": "刘胜亮的别墅"},  
      {"text": "张月栋的别墅", "children": []}  
    ]  
  }]  
  
  build() {  
    Column() {  
      TextPicker({ range: this.cascade }).canLoop(false)  
        .onChange((value: string | string[], index: number | number[]) => {  
          console.info('TextPicker 多列联动:onChange ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index))  
        })  
    }  
  }  
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
分享
微博
QQ
微信
回复
2024-10-21 15:26:31


相关问题
使用TextPicker控件显示异常问题
1501浏览 • 1回复 待解决
HarmonyOS TextPicker问题
535浏览 • 1回复 待解决
HarmonyOS textpicker组件使用咨询
1092浏览 • 1回复 待解决
HarmonyOS TextPicker
504浏览 • 1回复 待解决
HarmonyOS TextPicker多级联动展示问题
748浏览 • 1回复 待解决
HarmonyOS textpicker使用问题
738浏览 • 1回复 待解决
mysql b+索引关键码是怎么
2742浏览 • 1回复 待解决
HarmonyOS SM3加密怎么呢?
831浏览 • 1回复 待解决
如何优化过多import依赖
1159浏览 • 1回复 待解决
HarmonyOS TextPicker多列问题
909浏览 • 1回复 待解决
屏幕朗读器深度适配
355浏览 • 0回复 待解决
HarmonyOS 怎么高亮显示搜索文字
953浏览 • 1回复 待解决
HarmonyOS 是否支持MP3音频录制?
958浏览 • 1回复 待解决
HarmonyOS 能否支持3D模型导入?
1513浏览 • 0回复 待解决