【发布时间】:2019-05-31 20:15:13
【问题描述】:
我正在尝试将 vue-router 与 nativescript-vue 一起使用,但我收到错误 Cannot add a null child view to a Viewgroup
我按照 nativescript-vue 的文档,尝试将路由器放在外部文件中,但我得到了同样的错误。
import Vue from "nativescript-vue";
import VueDevtools from 'nativescript-vue-devtools';
Vue.use(VueDevtools, { host: '10.0.0.108' })
// import router from './router';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
import Home from '../components/Home';
import Login from '../components/Login';
const router = new VueRouter({
pageRouting: true,
routes: [
{ path: '/home', component: Home },
{ path: '/login', component: Login },
{ path: '*', redirect: '/home' },
],
});
router.replace('/home');
import store from './store';
// Uncommment the following to see NativeScript-Vue output logs
Vue.config.silent = false;
new Vue({
router,
store,
}).$start();
【问题讨论】:
标签: vue.js nativescript nativescript-vue