@@ -4,15 +4,14 @@ import { patch } from './patch'
4
4
import { mountComponent } from 'core/instance/lifecycle'
5
5
import { compileToFunctions } from '../compiler/index'
6
6
import { registerElement } from '../element-registry'
7
- import { isPage } from '../util/index'
8
- import { Page } from 'tns-core-modules/ui/page'
9
7
10
8
import Vue from 'core/index'
11
9
import DocumentNode from '../renderer/DocumentNode'
12
10
import platformComponents from './components/index'
13
11
import platformDirectives from './directives/index'
14
12
15
13
import { mustUseProp , isReservedTag , isUnknownElement } from '../util/index'
14
+ import { ensurePage } from '../util'
16
15
17
16
export const VUE_VM_REF = '__vue_vm_ref__'
18
17
@@ -22,47 +21,14 @@ Vue.config.isUnknownElement = isUnknownElement
22
21
23
22
Vue . $document = Vue . prototype . $document = new DocumentNode ( )
24
23
24
+ Vue . compile = compileToFunctions
25
25
Vue . registerElement = registerElement
26
26
27
27
Object . assign ( Vue . options . directives , platformDirectives )
28
28
Object . assign ( Vue . options . components , platformComponents )
29
29
30
30
Vue . prototype . __patch__ = patch
31
31
32
- Vue . prototype . $start = function ( ) {
33
- this . __is_root__ = true
34
-
35
- const placeholder = this . $document . createComment ( 'placeholder' )
36
-
37
- this . $mount ( placeholder )
38
- }
39
-
40
- const mount = function ( el , hydrating ) {
41
- if ( this . __is_root__ && ! this . __started__ ) {
42
- const self = this
43
- start ( {
44
- create ( ) {
45
- // Call mountComponent in the create callback when the IOS app loop has started
46
- // https://github.com/rigor789/nativescript-vue/issues/24
47
- mountComponent ( self , el , hydrating )
48
- self . __started__ = true
49
-
50
- const page = isPage ( self . $el ) ? self . $el . nativeView : new Page ( )
51
-
52
- if ( ! isPage ( self . $el ) ) {
53
- page . content = self . $el . nativeView
54
- }
55
-
56
- page [ VUE_VM_REF ] = self
57
-
58
- return page
59
- }
60
- } )
61
- } else {
62
- return mountComponent ( this , el , hydrating )
63
- }
64
- }
65
-
66
32
Vue . prototype . $mount = function ( el , hydrating ) {
67
33
const options = this . $options
68
34
// resolve template/el and convert to render function
@@ -77,30 +43,33 @@ Vue.prototype.$mount = function(el, hydrating) {
77
43
const { render, staticRenderFns } = compileToFunctions (
78
44
template ,
79
45
{
80
- delimiters : options . delimiters
46
+ delimiters : options . delimiters ,
47
+ comments : options . comments
81
48
} ,
82
49
this
83
50
)
84
51
options . render = render
85
52
options . staticRenderFns = staticRenderFns
86
53
}
87
54
}
88
- return mount . call ( this , el , hydrating )
55
+
56
+ return mountComponent ( this , el , hydrating )
89
57
}
90
58
91
- Vue . compile = compileToFunctions
92
- Vue . prototype . $renderTemplate = function ( template , context , oldVnode ) {
93
- let slot = template
94
- if ( typeof template !== 'function' ) {
95
- slot = this . $scopedSlots [ template ]
96
- ? this . $scopedSlots [ template ]
97
- : this . $scopedSlots . default
98
- }
59
+ Vue . prototype . $start = function ( ) {
60
+ const self = this
99
61
100
- let vnode = slot ( context ) [ 0 ]
101
- this . __patch__ ( oldVnode , vnode )
62
+ start ( {
63
+ create ( ) {
64
+ if ( self . $el ) {
65
+ self . $el . nativeView . parent = null
66
+ return self . $el . nativeView
67
+ }
102
68
103
- return vnode
69
+ self . $mount ( )
70
+ return ensurePage ( self . $el , self )
71
+ }
72
+ } )
104
73
}
105
74
106
75
export default Vue
0 commit comments