我正在尝试将 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();