Skip to content

Commit 7def3e2

Browse files
committed
fix: disable pageRouting when not in use
fix #98
1 parent f185cfc commit 7def3e2

File tree

5 files changed

+9
-80
lines changed

5 files changed

+9
-80
lines changed

Diff for: platform/nativescript/plugins/router-plugin.js

+7
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,21 @@ export default {
107107
}
108108

109109
const router = this.$options.router
110+
const isPageRouting = router.options.pageRouting
110111
const self = this
111112

113+
if (!isPageRouting) {
114+
// if not in page mode, we don't care
115+
return
116+
}
117+
112118
patchRouter(router, Vue)
113119

114120
// Overwrite the default $start function
115121
this.$start = () => {
116122
this.__is_root__ = true
117123
this.__started__ = true // skips the default start procedure
124+
this.$options.render = () => {} // removes warning for no render / template
118125

119126
// Mount the root component
120127
const placeholder = Vue.$document.createComment('placeholder')

Diff for: platform/nativescript/runtime/components/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import ActionBar from './action-bar'
22
import ActionItem from './action-item'
33
import ListView from './list-view'
44
import NavigationButton from './navigation-button'
5-
import RouterPage from './router-page'
65
import TabView from './tab-view'
76
import TabViewItem from './tab-view-item'
87
import VTemplate from './v-template'
@@ -12,7 +11,6 @@ export default {
1211
ActionItem,
1312
ListView,
1413
NavigationButton,
15-
RouterPage,
1614
TabView,
1715
TabViewItem,
1816
VTemplate

Diff for: platform/nativescript/runtime/components/router-page.js

-14
This file was deleted.

Diff for: samples/app/app-with-router-pages.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const Baz = {
4343
}
4444

4545
const router = new VueRouter({
46+
pageRouting: true,
4647
routes: [
4748
{ path: '/foo', component: Foo },
4849
{ path: '/bar', component: Bar },
@@ -54,9 +55,5 @@ const router = new VueRouter({
5455
router.replace('/foo')
5556

5657
new Vue({
57-
router,
58-
template: `<router-page />`,
59-
created() {
60-
// this.$setPageTransition('slide', 1000)
61-
}
58+
router
6259
}).$start()

Diff for: samples/app/app-with-tabview-router.js

-59
This file was deleted.

0 commit comments

Comments
 (0)