Skip to content

Commit ed1fd06

Browse files
committed
demo(vue): update
1 parent 5450968 commit ed1fd06

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

demo-snippets/vue/BasicPager.vue

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@
55
<Label text="Basic Pager" />
66
</ActionBar>
77

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%">
1010
<v-template>
1111
<GridLayout :backgroundColor="item.color">
1212
<Label :text="item.title" />
1313
</GridLayout>
1414
</v-template>
1515
</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>
1721
</Page>
1822
</template>
1923

20-
<script>
24+
<script lang="ts">
25+
import { Pager } from '@nativescript-community/ui-pager/index.android';
2126
export default {
2227
data() {
2328
return {
@@ -28,6 +33,14 @@ export default {
2833
{title: "Fourth", color: "#9b59b6"},
2934
]
3035
}
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+
}
3144
}
3245
};
3346
</script>

0 commit comments

Comments
 (0)