File tree 11 files changed +131
-24
lines changed 11 files changed +131
-24
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ and these awesome backers:
63
63
- Robert M. Svendsen
64
64
- Andy Drexler
65
65
- ChiwalahSoftware
66
+ - Nayir Chami
66
67
67
68
If you'd like to join them, please consider [ becoming a backer / sponsor on Patreon] ( https://www.patreon.com/rigor789 ) .
68
69
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export default {
5
5
functional : true ,
6
6
render ( h , { children } ) {
7
7
if ( isAndroid ) {
8
- return children [ 0 ]
8
+ return children
9
9
}
10
10
}
11
11
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export default {
5
5
functional : true ,
6
6
render ( h , { children } ) {
7
7
if ( isIOS ) {
8
- return children [ 0 ]
8
+ return children
9
9
}
10
10
}
11
11
}
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ export default {
82
82
const oldVnode = args . view && args . view [ VUE_VIEW ]
83
83
84
84
args . view = this . $templates . patchTemplate ( name , context , oldVnode )
85
+ } ,
86
+ refresh ( ) {
87
+ this . $refs . listView . nativeView . refresh ( )
85
88
}
86
89
}
87
90
}
Original file line number Diff line number Diff line change @@ -101,9 +101,9 @@ export class VueKeyedTemplate /* implements KeyedTemplate */ {
101
101
}
102
102
103
103
createView ( ) {
104
- const vnode = this . _scopedFn ( deepProxy ( { } ) )
105
- const nativeView = patch ( null , vnode ) . nativeView
106
- nativeView [ VUE_VIEW ] = vnode
107
- return nativeView
104
+ // we are returning null because we don't have the data here
105
+ // the view will be created in the `patchTemplate` method above.
106
+ // see https://github.com/nativescript-vue/nativescript-vue/issues/229#issuecomment-390330474
107
+ return null
108
108
}
109
109
}
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import platformComponents from './components/index'
11
11
import platformDirectives from './directives/index'
12
12
13
13
import { mustUseProp , isReservedTag , isUnknownElement } from '../util/index'
14
- import { ensurePage } from '../util'
15
14
16
15
export const VUE_VM_REF = '__vue_vm_ref__'
17
16
@@ -56,7 +55,7 @@ Vue.prototype.$mount = function(el, hydrating) {
56
55
return mountComponent ( this , el , hydrating )
57
56
}
58
57
59
- Vue . prototype . $start = function ( { getRootView } ) {
58
+ Vue . prototype . $start = function ( ) {
60
59
let self = this
61
60
const AppConstructor = Vue . extend ( this . $options )
62
61
@@ -67,10 +66,7 @@ Vue.prototype.$start = function({ getRootView }) {
67
66
}
68
67
69
68
self . $mount ( )
70
- args . root =
71
- typeof getRootView === 'function'
72
- ? getRootView ( self )
73
- : ensurePage ( self . $el , self )
69
+ args . root = self . $el . nativeView
74
70
} )
75
71
76
72
run ( )
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ export function isPage(el) {
34
34
return el && el . tagName === 'page'
35
35
}
36
36
37
+ /** @deprecated */
37
38
export function ensurePage ( el , vm ) {
38
39
if ( ! isPage ( el ) ) {
39
40
const page = new ( getViewClass ( 'page' ) ) ( )
Original file line number Diff line number Diff line change
1
+ const Vue = require ( './nativescript-vue' )
2
+
3
+ Vue . config . silent = false
4
+
5
+ new Vue ( {
6
+ data : {
7
+ foo : false
8
+ } ,
9
+ template : `
10
+ <Frame>
11
+ <Page>
12
+ <ActionBar title="Issue #127" />
13
+
14
+ <StackLayout>
15
+ <Label v-if="foo" text="Enable" @tap="foo = false"/>
16
+ <Label v-if="!foo" text="Disable" @tap="foo = true"/>
17
+ </StackLayout>
18
+ </Page>
19
+ </Frame>
20
+ ` ,
21
+ created ( ) {
22
+ console . log ( Vue . compile ( this . $options . template ) . render . toString ( ) )
23
+ }
24
+ } ) . $start ( )
Original file line number Diff line number Diff line change
1
+ const Vue = require ( './nativescript-vue' )
2
+
3
+ Vue . config . silent = false
4
+
5
+ new Vue ( {
6
+ data : {
7
+ items : [ { color : 'red' } , { color : 'blue' } ]
8
+ } ,
9
+ template : `
10
+ <Frame>
11
+ <Page>
12
+ <ActionBar title="Issue #229" />
13
+
14
+ <GridLayout>
15
+ <ListView for="item in items" class="list-group">
16
+ <v-template>
17
+ <Label :backgroundColor="item.color" :text="item.color" padding="50" />
18
+ </v-template>
19
+ </ListView>
20
+ </GridLayout>
21
+ </Page>
22
+ </Frame>
23
+ `
24
+ } ) . $start ( )
Original file line number Diff line number Diff line change
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 ( )
Original file line number Diff line number Diff line change @@ -2,18 +2,20 @@ const Vue = require('./nativescript-vue')
2
2
3
3
new Vue ( {
4
4
template : `
5
- <Page>
6
- <StackLayout>
7
- <Label android:text="hi android" ios:text="hi ios..." />
8
-
9
- <android>
10
- <Label text="hello android" />
11
- </android>
12
- <ios>
13
- <Label text="hello ios" />
14
- </ios>
15
- </StackLayout>
16
- </Page>
5
+ <Page>
6
+ <StackLayout>
7
+ <Label android:text="hi android" ios:text="hi ios..." />
8
+
9
+ <android>
10
+ <Label text="hello android" />
11
+ <Label text="hello android 2" />
12
+ </android>
13
+ <ios>
14
+ <Label text="hello ios" />
15
+ <Label text="hello ios 2" />
16
+ </ios>
17
+ </StackLayout>
18
+ </Page>
17
19
`
18
20
} ) . $start ( {
19
21
getRootView ( self ) {
You can’t perform that action at this time.
0 commit comments