88 <GridLayout rows =" auto,*" >
99 <CollectionView ref =" collectionView" :items =" itemList" row =" 1" :autoReloadItemOnLayout =" true" >
1010 <template #default =" { item } " >
11- <GridLayout class =" item" rows =" 101,100" @tap =" resizeCell(item, $event)" :height =" getItemHeight(item)"
12- :backgroundColor =" item.color" >
11+ <GridLayout class =" item" rows =" 101,100" @tap =" resizeCell(item, $event)" :height =" getItemHeight(item)" :backgroundColor =" item.color" >
1312 <Stacklayout row =" 0" >
1413 <Label row =" 1" :text =" item.name" class =" title" />
1514 <Label row =" 1" :text =" item.color" class =" subtitle" />
2120 </GridLayout >
2221 </template >
2322 </CollectionView >
24-
2523 </GridLayout >
2624 </Page >
2725</template >
2826
2927<script setup lang="ts">
3028// FIXME: Not work in ios
3129import { ObservableArray , View } from ' @nativescript/core' ;
32- import { ref } from " nativescript-vue"
30+ import { $navigateBack , ref } from ' nativescript-vue' ;
3331
3432const collectionView = ref ();
35- const itemList = ref (new ObservableArray ([
36- { index: 0 , name: ' TURQUOISE' , color: ' #1abc9c' },
37- { index: 1 , name: ' EMERALD' , color: ' #2ecc71' },
38- { index: 2 , name: ' PETER RIVER' , color: ' #3498db' },
39- { index: 3 , name: ' AMETHYST' , color: ' #9b59b6' },
40- { index: 4 , name: ' WET ASPHALT' , color: ' #34495e' },
41- { index: 5 , name: ' GREEN SEA' , color: ' #16a085' },
42- { index: 6 , name: ' NEPHRITIS' , color: ' #27ae60' },
43- { index: 7 , name: ' BELIZE HOLE' , color: ' #2980b9' },
44- { index: 8 , name: ' WISTERIA' , color: ' #8e44ad' },
45- { index: 9 , name: ' MIDNIGHT BLUE' , color: ' #2c3e50' },
46- { index: 10 , name: ' SUN FLOWER' , color: ' #f1c40f' },
47- { index: 11 , name: ' CARROT' , color: ' #e67e22' },
48- { index: 12 , name: ' ALIZARIN' , color: ' #e74c3c' },
49- { index: 13 , name: ' CLOUDS' , color: ' #ecf0f1' },
50- { index: 14 , name: ' CONCRETE' , color: ' #95a5a6' },
51- { index: 15 , name: ' ORANGE' , color: ' #f39c12' },
52- { index: 16 , name: ' PUMPKIN' , color: ' #d35400' },
53- { index: 17 , name: ' POMEGRANATE' , color: ' #c0392b' },
54- { index: 18 , name: ' SILVER' , color: ' #bdc3c7' },
55- { index: 19 , name: ' ASBESTOS' , color: ' #7f8c8d' }
56- ]));
33+ const itemList = ref (
34+ new ObservableArray ([
35+ { index: 0 , name: ' TURQUOISE' , color: ' #1abc9c' },
36+ { index: 1 , name: ' EMERALD' , color: ' #2ecc71' },
37+ { index: 2 , name: ' PETER RIVER' , color: ' #3498db' },
38+ { index: 3 , name: ' AMETHYST' , color: ' #9b59b6' },
39+ { index: 4 , name: ' WET ASPHALT' , color: ' #34495e' },
40+ { index: 5 , name: ' GREEN SEA' , color: ' #16a085' },
41+ { index: 6 , name: ' NEPHRITIS' , color: ' #27ae60' },
42+ { index: 7 , name: ' BELIZE HOLE' , color: ' #2980b9' },
43+ { index: 8 , name: ' WISTERIA' , color: ' #8e44ad' },
44+ { index: 9 , name: ' MIDNIGHT BLUE' , color: ' #2c3e50' },
45+ { index: 10 , name: ' SUN FLOWER' , color: ' #f1c40f' },
46+ { index: 11 , name: ' CARROT' , color: ' #e67e22' },
47+ { index: 12 , name: ' ALIZARIN' , color: ' #e74c3c' },
48+ { index: 13 , name: ' CLOUDS' , color: ' #ecf0f1' },
49+ { index: 14 , name: ' CONCRETE' , color: ' #95a5a6' },
50+ { index: 15 , name: ' ORANGE' , color: ' #f39c12' },
51+ { index: 16 , name: ' PUMPKIN' , color: ' #d35400' },
52+ { index: 17 , name: ' POMEGRANATE' , color: ' #c0392b' },
53+ { index: 18 , name: ' SILVER' , color: ' #bdc3c7' },
54+ { index: 19 , name: ' ASBESTOS' , color: ' #7f8c8d' }
55+ ])
56+ );
5757
5858function getItemHeight(item ) {
59- return item .showMenu === true ? 200 : 100
59+ return item .showMenu === true ? 200 : 100 ;
6060}
6161
6262async function resizeCell(item , event ) {
@@ -67,11 +67,10 @@ async function resizeCell(item, event) {
6767 const newHeight = actualItem .showMenu ? 200 : 100 ;
6868 return (event .object as View ).animate ({ height: newHeight , ... options , duration: 300 });
6969 }
70-
70+
7171 await animate ();
7272 } catch (error ) {
7373 console .error (error );
7474 }
7575}
7676 </script >
77-
0 commit comments