Showing
3 changed files
with
17 additions
and
7 deletions
| @@ -19,7 +19,7 @@ export struct FirstLevelComponent { | @@ -19,7 +19,7 @@ export struct FirstLevelComponent { | ||
| 19 | Column(){ | 19 | Column(){ |
| 20 | Column(){ | 20 | Column(){ |
| 21 | if (this.labelList.length === 0){ | 21 | if (this.labelList.length === 0){ |
| 22 | - Text('暂无数据').fontSize(20) | 22 | + Text('').fontSize(20) |
| 23 | }else { | 23 | }else { |
| 24 | TextPicker({range:this.labelList,selected:this.select}) | 24 | TextPicker({range:this.labelList,selected:this.select}) |
| 25 | .canLoop(false) | 25 | .canLoop(false) |
| @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel | @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel | ||
| 2 | import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; | 2 | import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; |
| 3 | @Component | 3 | @Component |
| 4 | export struct SecondLevelComponent { | 4 | export struct SecondLevelComponent { |
| 5 | - @State mTip: string = '暂无数据' | 5 | + @State mTip: string = '' |
| 6 | @State labelList: string[] = []; | 6 | @State labelList: string[] = []; |
| 7 | @State select: number = 0; | 7 | @State select: number = 0; |
| 8 | @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; | 8 | @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; |
| @@ -43,14 +43,19 @@ export struct SecondLevelComponent { | @@ -43,14 +43,19 @@ export struct SecondLevelComponent { | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | if (!this.currentFirst) { | 45 | if (!this.currentFirst) { |
| 46 | - this.mTip = '暂无数据'; | 46 | + this.mTip = ''; |
| 47 | } else { | 47 | } else { |
| 48 | this.labelList = [] | 48 | this.labelList = [] |
| 49 | for (let index = 0; index < this.currentFirst.children.length; index++) { | 49 | for (let index = 0; index < this.currentFirst.children.length; index++) { |
| 50 | const element = this.currentFirst.children[index]; | 50 | const element = this.currentFirst.children[index]; |
| 51 | this.labelList.push(element.label) | 51 | this.labelList.push(element.label) |
| 52 | } | 52 | } |
| 53 | - this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select]) | 53 | + if (this.currentFirst.children.length > 0) { |
| 54 | + this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select]) | ||
| 55 | + }else { | ||
| 56 | + this.currentSecondBean = new AreaListManageModel('0','0','0',[]) | ||
| 57 | + } | ||
| 58 | + | ||
| 54 | } | 59 | } |
| 55 | } | 60 | } |
| 56 | } | 61 | } |
| @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel | @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel | ||
| 2 | import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; | 2 | import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; |
| 3 | @Component | 3 | @Component |
| 4 | export struct ThirdLevelComponent { | 4 | export struct ThirdLevelComponent { |
| 5 | - @State mTip: string = '暂无数据' | 5 | + @State mTip: string = '' |
| 6 | @State labelList: string[] = []; | 6 | @State labelList: string[] = []; |
| 7 | @State select: number = 0; | 7 | @State select: number = 0; |
| 8 | @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; | 8 | @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; |
| @@ -52,14 +52,19 @@ export struct ThirdLevelComponent { | @@ -52,14 +52,19 @@ export struct ThirdLevelComponent { | ||
| 52 | this.select = 0 | 52 | this.select = 0 |
| 53 | } | 53 | } |
| 54 | if (!this.currentSecondBean) { | 54 | if (!this.currentSecondBean) { |
| 55 | - this.mTip = '暂无数据'; | 55 | + this.mTip = ''; |
| 56 | } else { | 56 | } else { |
| 57 | this.labelList = [] | 57 | this.labelList = [] |
| 58 | for (let index = 0; index < this.currentSecondBean.children.length; index++) { | 58 | for (let index = 0; index < this.currentSecondBean.children.length; index++) { |
| 59 | const element = this.currentSecondBean.children[index]; | 59 | const element = this.currentSecondBean.children[index]; |
| 60 | this.labelList.push(element.label) | 60 | this.labelList.push(element.label) |
| 61 | } | 61 | } |
| 62 | - this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select]) | 62 | + |
| 63 | + if (this.currentSecondBean.children.length > 0) { | ||
| 64 | + this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select]) | ||
| 65 | + }else { | ||
| 66 | + this.currentThirdBean = new AreaListManageModel('0','0','0',[]) | ||
| 67 | + } | ||
| 63 | } | 68 | } |
| 64 | } | 69 | } |
| 65 | } | 70 | } |
-
Please register or login to post a comment