Showing
3 changed files
with
15 additions
and
12 deletions
| @@ -23,7 +23,7 @@ struct BrowsingHistoryPage { | @@ -23,7 +23,7 @@ struct BrowsingHistoryPage { | ||
| 23 | @State allDatas :CompDTO[] = []; | 23 | @State allDatas :CompDTO[] = []; |
| 24 | @State selectDatas :CompDTO[] = []; | 24 | @State selectDatas :CompDTO[] = []; |
| 25 | @Provide deleteNum :number = 0; | 25 | @Provide deleteNum :number = 0; |
| 26 | - | 26 | + @Provide isAllSelect:boolean = false |
| 27 | aboutToAppear(){ | 27 | aboutToAppear(){ |
| 28 | this.getData() | 28 | this.getData() |
| 29 | } | 29 | } |
| @@ -46,8 +46,8 @@ struct BrowsingHistoryPage { | @@ -46,8 +46,8 @@ struct BrowsingHistoryPage { | ||
| 46 | 46 | ||
| 47 | if (this.isEditState){ | 47 | if (this.isEditState){ |
| 48 | CustomBottomFuctionUI({ | 48 | CustomBottomFuctionUI({ |
| 49 | - selectAllCallback:(isOn)=>{ | ||
| 50 | - this.allSelectDatas(isOn) | 49 | + selectAllCallback:(isAllSelect)=>{ |
| 50 | + this.allSelectDatas(isAllSelect) | ||
| 51 | }, | 51 | }, |
| 52 | confirmCallback:()=>{ | 52 | confirmCallback:()=>{ |
| 53 | this.deleteDatas() | 53 | this.deleteDatas() |
| @@ -142,6 +142,8 @@ struct BrowsingHistoryPage { | @@ -142,6 +142,8 @@ struct BrowsingHistoryPage { | ||
| 142 | this.selectDatas.splice(this.selectDatas.indexOf(compDTO),1) | 142 | this.selectDatas.splice(this.selectDatas.indexOf(compDTO),1) |
| 143 | } | 143 | } |
| 144 | this.deleteNum = this.selectDatas.length | 144 | this.deleteNum = this.selectDatas.length |
| 145 | + | ||
| 146 | + this.isAllSelect = this.deleteNum === this.allDatas.length?true:false; | ||
| 145 | } | 147 | } |
| 146 | 148 | ||
| 147 | //全选 | 149 | //全选 |
| @@ -174,4 +176,3 @@ struct BrowsingHistoryPage { | @@ -174,4 +176,3 @@ struct BrowsingHistoryPage { | ||
| 174 | this.isEditState = false | 176 | this.isEditState = false |
| 175 | } | 177 | } |
| 176 | } | 178 | } |
| 177 | - |
| @@ -23,7 +23,7 @@ struct MyCollectionListPage { | @@ -23,7 +23,7 @@ struct MyCollectionListPage { | ||
| 23 | @State allDatas :CompDTO[] = []; | 23 | @State allDatas :CompDTO[] = []; |
| 24 | @State selectDatas :CompDTO[] = []; | 24 | @State selectDatas :CompDTO[] = []; |
| 25 | @Provide deleteNum :number = 0; | 25 | @Provide deleteNum :number = 0; |
| 26 | - | 26 | + @Provide isAllSelect:boolean = false |
| 27 | aboutToAppear(){ | 27 | aboutToAppear(){ |
| 28 | this.getData() | 28 | this.getData() |
| 29 | } | 29 | } |
| @@ -46,8 +46,8 @@ struct MyCollectionListPage { | @@ -46,8 +46,8 @@ struct MyCollectionListPage { | ||
| 46 | 46 | ||
| 47 | if (this.isEditState){ | 47 | if (this.isEditState){ |
| 48 | CustomBottomFuctionUI({ | 48 | CustomBottomFuctionUI({ |
| 49 | - selectAllCallback:(isOn)=>{ | ||
| 50 | - this.allSelectDatas(isOn) | 49 | + selectAllCallback:(isAllSelect)=>{ |
| 50 | + this.allSelectDatas(isAllSelect) | ||
| 51 | }, | 51 | }, |
| 52 | confirmCallback:()=>{ | 52 | confirmCallback:()=>{ |
| 53 | this.deleteDatas() | 53 | this.deleteDatas() |
| @@ -142,6 +142,8 @@ struct MyCollectionListPage { | @@ -142,6 +142,8 @@ struct MyCollectionListPage { | ||
| 142 | this.selectDatas.splice(this.selectDatas.indexOf(compDTO),1) | 142 | this.selectDatas.splice(this.selectDatas.indexOf(compDTO),1) |
| 143 | } | 143 | } |
| 144 | this.deleteNum = this.selectDatas.length | 144 | this.deleteNum = this.selectDatas.length |
| 145 | + | ||
| 146 | + this.isAllSelect = this.deleteNum === this.allDatas.length?true:false; | ||
| 145 | } | 147 | } |
| 146 | 148 | ||
| 147 | //全选 | 149 | //全选 |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | @Component | 2 | @Component |
| 3 | export struct CustomBottomFuctionUI { | 3 | export struct CustomBottomFuctionUI { |
| 4 | @Consume deleteNum: number | 4 | @Consume deleteNum: number |
| 5 | - @State isOn: boolean = false | 5 | + @Consume isAllSelect: boolean |
| 6 | selectAllCallback: (isOn: boolean) => void = () => { | 6 | selectAllCallback: (isOn: boolean) => void = () => { |
| 7 | } | 7 | } |
| 8 | confirmCallback: () => void = () => { | 8 | confirmCallback: () => void = () => { |
| @@ -10,12 +10,12 @@ export struct CustomBottomFuctionUI { | @@ -10,12 +10,12 @@ export struct CustomBottomFuctionUI { | ||
| 10 | build() { | 10 | build() { |
| 11 | RelativeContainer(){ | 11 | RelativeContainer(){ |
| 12 | Row(){ | 12 | Row(){ |
| 13 | - Image(this.isOn?$r("app.media.MyCollection_selected_icon"):$r("app.media.MyCollection_unselected_icon")) | 13 | + Image(this.isAllSelect?$r("app.media.MyCollection_selected_icon"):$r("app.media.MyCollection_unselected_icon")) |
| 14 | .width('20') | 14 | .width('20') |
| 15 | .height('20') | 15 | .height('20') |
| 16 | .margin({right:'31lpx' }) | 16 | .margin({right:'31lpx' }) |
| 17 | 17 | ||
| 18 | - Text(this.isOn?'取消':'全选') | 18 | + Text(this.isAllSelect?'取消':'全选') |
| 19 | .fontColor($r('app.color.color_222222')) | 19 | .fontColor($r('app.color.color_222222')) |
| 20 | .backgroundColor(Color.White) | 20 | .backgroundColor(Color.White) |
| 21 | } | 21 | } |
| @@ -26,8 +26,8 @@ export struct CustomBottomFuctionUI { | @@ -26,8 +26,8 @@ export struct CustomBottomFuctionUI { | ||
| 26 | left: {anchor: "__container__", align: HorizontalAlign.Start} | 26 | left: {anchor: "__container__", align: HorizontalAlign.Start} |
| 27 | }) | 27 | }) |
| 28 | .onClick(()=>{ | 28 | .onClick(()=>{ |
| 29 | - this.isOn = !this.isOn; | ||
| 30 | - this.selectAllCallback(this.isOn) | 29 | + this.isAllSelect = !this.isAllSelect; |
| 30 | + this.selectAllCallback(this.isAllSelect) | ||
| 31 | }) | 31 | }) |
| 32 | 32 | ||
| 33 | 33 |
-
Please register or login to post a comment