Skip to content

Commit eb5f0c7

Browse files
committed
test: add repro case for nativescript-vue#231
re nativescript-vue#231
1 parent 6048f5a commit eb5f0c7

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

samples/app/231.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const Vue = require('./nativescript-vue')
2+
3+
Vue.config.silent = false
4+
5+
const ImageCard = {
6+
props: {
7+
src: {
8+
type: String,
9+
required: true
10+
}
11+
},
12+
template: '<Image :src="src" stretch="aspectFit" />'
13+
}
14+
const url = 'https://api.giphy.com/v1/gifs/search'
15+
const key = 'ZboEpjHv00FzK6SI7l33H7wutWlMldQs'
16+
const filter = 'limit=25&offset=0&rating=G&lang=fr'
17+
18+
new Vue({
19+
components: {
20+
ImageCard
21+
},
22+
template: `
23+
<Frame>
24+
<Page class="page">
25+
<ActionBar class="action-bar" title="Poket Gif" />
26+
27+
<StackLayout class="layout">
28+
<SearchBar hint="Chercher un gif" ref="search" v-model="q" @submit="search" />
29+
30+
<ListView for="img in imgs" height="100%">
31+
<v-template>
32+
<ImageCard :src="img.images.downsized.url" />
33+
</v-template>
34+
</ListView>
35+
</StackLayout>
36+
</Page>
37+
</Frame>
38+
`,
39+
40+
data() {
41+
return {
42+
imgs: [],
43+
surprise: false,
44+
q: ''
45+
}
46+
},
47+
48+
methods: {
49+
search() {
50+
this.$refs.search.nativeView.dismissSoftInput()
51+
fetch(`${url}?api_key=${key}&q=${this.q}&${filter}`)
52+
.then(response => response.json())
53+
.then(json => (this.imgs = json.data))
54+
}
55+
}
56+
}).$start()

0 commit comments

Comments
 (0)