8000 chore: add test cases and update demo · heywhy/nativescript-vue@cc81f5d · GitHub
[go: up one dir, main page]

Skip to content

Commit cc81f5d

Browse files
committed
chore: add test cases and update demo
1 parent 0f84f84 commit cc81f5d

File tree

6 files changed

+55
-5
lines changed

6 files changed

+55
-5
lines changed

demo/app/app.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { createApp } from "vue";
44
global.window = global;
55
// import Home from './components/Home.vue'
66

7-
import App from "./components/GH1010.vue";
7+
import App from "./components/demo_ListView.vue";
88

9-
createApp(App).start();
9+
createApp(App)
10+
.use(() => {
11+
console.log("test1");
12+
})
13+
.start();

demo/app/components/GH1010.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- https://github.com/nativescript-vue/nativescript-vue/issues/1010 -->
12
<script lang="ts" setup>
23
import { ref } from "vue";
34

demo/app/components/GH1012.vue

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<script lang="ts" setup>
2+
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
3+
4+
async function animateIn(args) {
5+
console.log("ANIMATE")
6+
await wait(1);
7+
const view = args.object;
8+
view.color = "green";
9+
view.scaleX = 0;
10+
view.scaleY = 0;
11+
12+
view
13+
.animate({
14+
opacity: 1,
15+
scale: {
16+
x: 1,
17+
y: 1,
18+
},
19+
duration: 3000,
20+
})
21+
.then(() => {
22+
view.color = "red";
23+
})
24+
.catch((err) => console.log(err));
25+
}
26+
</script>
27+
28+
<template>
29+
<Button
30+
ref="btnNewTrip"
31+
opacity="0"
32+
scaleX="0.1"
33+
scaleY="0.1"
34+
@loaded="animateIn"
35+
@tap="animateIn"
36+
>
37+
New Trip
38+
</Button>
39+
</template>

demo/app/components/Home.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<script setup lang="ts">
22
import Test from "./Test.vue";
33
import { goHome } from "~/composables/goHome";
4+
import { onUnmounted } from "vue";
45
56
defineProps<{
67
depth?: number;
78
}>();
89
9-
const message = "Hello World";
10+
const message = "Hello World!";
1011
1112
interface Test {
1213
name: string;
@@ -26,10 +27,14 @@ function selector(item: ListItem<Test>) {
2627
return item.even ? "default" : "odd";
2728
}
2829
30+
onUnmounted(() => {
31+
console.log("UNMOUNTED HOME");
32+
});
2933
</script>
3034

3135
<template>
3236
<Page>
37+
<ActionBar :title="`Depth: ${depth}`"></ActionBar>
3338
<StackLayout>
3439
<Label class="info" :text="message + ' ' + depth" />
3540
<Button text="Go home" @tap="goHome(depth + 1)" />

demo/app/components/demo_ListView.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ const onItemTap = useDebounceFn((item) => {
8181
<Frame>
8282
<Page>
8383
<GridLayout rows="auto, auto, *">
84-
<Button text="Navigate" @tap="navigate" />
8584
<Label
8685
rew="1"
8786
:text="fps"
@@ -91,6 +90,8 @@ const onItemTap = useDebounceFn((item) => {
9190
fontSize="32"
9291
fontWeight="bold"
9392
/>
93+
<Button text="Navigate" @tap="navigate" padding="32" fontSize="24" />
94+
9495
<StackLayout row="2">
9596
<Label>Hello: {{ name }}</Label>
9697
<Button

demo/app/composables/goHome.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function goHome(depth = 0, modal = false) {
1010
});
1111
}
1212
$navigateTo(Home, {
13-
clearHistory: true,
13+
// clearHistory: true,
1414
props: {
1515
depth,
1616
},

0 commit comments

Comments
 (0)
0