File tree Expand file tree Collapse file tree 1 file changed +8
-27
lines changed
platform/nativescript/runtime/components Expand file tree Collapse file tree 1 file changed +8
-27
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,6 @@ export default {
11
11
this . $slots . default
12
12
)
13
13
} ,
14
- // created() {
15
- // if (this.$router) {
16
- // // Sometimes the parent is undefined
17
- // // See https://github.com/nativescript-vue/nativescript-vue/issues/292
18
- // if (this.$vnode.parent) {
19
- // this.$vnode.parent.data.keepAlive = true
20
- // }
21
- // }
22
- // },
23
14
mounted ( ) {
24
15
this . $el . nativeView [ PAGE_REF ] = this
25
16
@@ -32,16 +23,19 @@ export default {
32
23
const handler = e => {
33
24
if ( e . isBackNavigation ) {
34
25
this . $el . nativeView . off ( 'navigatedFrom' , handler )
35
-
36
- // if (this.$router) {
37
- // this.$parent.$vnode.data.keepAlive = false
38
- // }
39
-
40
26
this . $parent . $destroy ( )
41
27
}
42
28
}
43
29
44
30
this . $el . nativeView . on ( 'navigatedFrom' , handler )
31
+
32
+ // ensure that the parent vue instance is destroyed when the
33
+ // page is disposed (clearHistory: true for example)
34
+ const dispose = this . $el . nativeView . disposeNativeView
35
+ this . $el . nativeView . disposeNativeView = ( ...args ) => {
36
+ this . $parent . $destroy ( )
37
+ dispose . call ( this . $el . nativeView , args )
38
+ }
45
39
} ,
46
40
methods : {
47
41
_findParentFrame ( ) {
@@ -54,17 +48,4 @@ export default {
54
48
return frame
55
49
}
56
50
}
57
- // deactivated() {
58
- // if (this.$router) {
59
- // if (this._watcher) {
60
- // this._watcher.teardown()
61
- // }
62
- //
63
- // let i = this._watchers.length
64
- //
65
- // while (i--) {
66
- // this._watchers[i].teardown()
67
- // }
68
- // }
69
- // }
70
51
}
You can’t perform that action at this time.
0 commit comments