Skip to content

Commit 3c118f0

Browse files
committed
demo(vue): more tests
1 parent 8f76822 commit 3c118f0

File tree

5 files changed

+81
-6
lines changed

5 files changed

+81
-6
lines changed

demo-snippets/vue/ColorFilter.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</ActionBar>
66

77
<GridLayout rows="*, auto, auto">
8-
<NSZoomImg backgroundColor="yellow" ref="opacityImg" placeholderImageUri="res://logo" :colorMatrix="colorMatrix" :src="src"> </NSZoomImg>
8+
<NSImg backgroundColor="yellow" ref="opacityImg" placeholderImageUri="res://logo" :colorMatrix="colorMatrix" :src="src"> </NSImg>
99
<StackLayout orientation="horizontal" row="1">
1010
<Button text="nightVision" row="1" @tap="onSetNightVision"></Button>
1111
<Button text="polaroid" @tap="onSetPolaroid"></Button>
@@ -47,9 +47,9 @@ export default {
4747
data: function() {
4848
return {
4949
colorMatrix:filters.nightVision,
50-
src:'~/images/dessert.jpg',
50+
src:'~/assets/images/dessert.jpg',
5151
// warning image source native android image will not be released!
52-
imgSource: ImageSource.fromFileSync('~/images/dessert.jpg')
52+
// imgSource: ImageSource.fromFileSync('~/assets/images/dessert.jpg')
5353
};
5454
},
5555
methods: {
@@ -69,7 +69,7 @@ export default {
6969
this.colorMatrix = null
7070
},
7171
onChangeImage(){
72-
this.src= this.src=== '~/images/dessert.jpg' ? '~/images/drink.jpg': '~/images/dessert.jpg';
72+
this.src= this.src=== '~/assets/images/dessert.jpg' ? '~/assets/images/drink.jpg': '~/assets/images/dessert.jpg';
7373
}
7474
}
7575
};

demo-snippets/vue/Details.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<script lang="ts">
2+
</script>
3+
4+
<template>
5+
<Page >
6+
<ActionBar>
7+
<Label text="Details" />
8+
</ActionBar>
9+
<GridLayout rows="auto, *">
10+
<Img
11+
height="200"
12+
row="1"
13+
width="200"
14+
src="https://images.unsplash.com/photo-1615870216519-2f9fa575fa5c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NXx8TWV4aWNhbiUyMGZvb2R8ZW58MHx8MHx8fDA%3D&auto=format&fit=crop&w=500&q=60"
15+
/>
16+
</GridLayout>
17+
</Page>
18+
</template>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<template>
2+
<Page>
3+
<ActionBar>
4+
<Label text="NavigationTest" />
5+
</ActionBar>
6+
7+
<GridLayout rows="auto,*, auto">
8+
<Img
9+
height="200"
10+
width="200"
11+
src="https://images.unsplash.com/photo-1615870216519-2f9fa575fa5c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NXx8TWV4aWNhbiUyMGZvb2R8ZW58MHx8MHx8fDA%3D&auto=format&fit=crop&w=500&q=60"
12+
/>
13+
14+
<Button
15+
row="2"
16+
text="View Details"
17+
@tap="onNavigate"
18+
class="mt-4 px-4 py-2 bg-white border-2 border-blue-400 rounded-lg"
19+
horizontalAlignment="center"
20+
>
21+
</Button>
22+
</StackLayout>
23+
</GridLayout>
24+
</Page>
25+
</template>
26+
27+
<script lang="ts">
28+
import { ImageSource } from '@nativescript/core';
29+
import Details from './Details.vue';
30+
31+
export default {
32+
methods: {
33+
onNavigate(args) {
34+
this.$navigateTo(Details, {transition: {name: 'slideLeft', duration: 2000}});
35+
},
36+
}
37+
};
38+
</script>
39+
40+
<style scoped lang="scss">
41+
ActionBar {
42+
background-color: #42b883;
43+
}
44+
.item {
45+
padding: 10;
46+
color: white;
47+
.title {
48+
font-size: 17;
49+
font-weight: bold;
50+
}
51+
.subtitle {
52+
font-size: 14;
53+
}
54+
}
55+
</style>

demo-snippets/vue/ZoomImage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<Page>
33
<ActionBar>
4-
<Label text="Simple Grid" />
4+
<Label text="Zoom Image" />
55
</ActionBar>
66

77
<NSZoomImg :src="imgSource"/>
@@ -15,7 +15,7 @@ export default {
1515
data: function() {
1616
return {
1717
// warning image source native android image will not be released!
18-
imgSource: ImageSource.fromFileSync('~/images/dessert.jpg')
18+
imgSource: ImageSource.fromFileSync('~/assets/images/dessert.jpg')
1919
};
2020
},
2121
};

demo-snippets/vue/install.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { installMixins } from '@nativescript-community/ui-image-colorfilter';
99
import Simple from './Simple.vue';
1010
import ZoomImage from './ZoomImage.vue';
1111
import ColorFilter from './ColorFilter.vue';
12+
import NavigationTest from './NavigationTest.vue';
1213

1314
Trace.addCategories('NativescriptImage');
1415
Trace.enable();
@@ -22,6 +23,7 @@ export function installPlugin() {
2223

2324
export const demos = [
2425
{ name: 'Simple', path: 'simple', component: Simple },
26+
{ name: 'NavigationTest', path: 'navigation', component: NavigationTest },
2527
{ name: 'ZoomImage', path: 'zoom', component: ZoomImage },
2628
{ name: 'ColorFilter', path: 'color-filter', component: ColorFilter }
2729
];

0 commit comments

Comments
 (0)