File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 5
5
<Label text =" Basic Pager" />
6
6
</ActionBar >
7
7
8
- <StackLayout class =" page" >
9
- <Pager for =" item in items" height =" 100%" >
8
+ <GridLayout class =" page" rows = " *,auto " >
9
+ <Pager ref = " pager " for =" item in items" height =" 100%" >
10
10
<v-template >
11
11
<GridLayout :backgroundColor =" item.color" >
12
12
<Label :text =" item.title" />
13
13
</GridLayout >
14
14
</v-template >
15
15
</Pager >
16
- </StackLayout >
16
+ <StackLayout orientation =" horizontal" row =" 1" >
17
+ <Button text =" moveTo0" @tap =" moveTo0" ></Button >
18
+ <Button text =" moveTo3" @tap =" moveTo3" ></Button >
19
+ </StackLayout >
20
+ </GridLayout >
17
21
</Page >
18
22
</template >
19
23
20
- <script >
24
+ <script lang="ts">
25
+ import { Pager } from ' @nativescript-community/ui-pager/index.android' ;
21
26
export default {
22
27
data() {
23
28
return {
@@ -28,6 +33,14 @@ export default {
28
33
{title: " Fourth" , color: " #9b59b6" },
29
34
]
30
35
}
36
+ },
37
+ methods: {
38
+ moveTo3() {
39
+ (this .$refs .pager .nativeView as Pager ).scrollToIndexAnimated (3 , true );
40
+ },
41
+ moveTo0() {
42
+ (this .$refs .pager .nativeView as Pager ).scrollToIndexAnimated (0 , false );
43
+ }
31
44
}
32
45
};
33
46
</script >
You can’t perform that action at this time.
0 commit comments