【发布时间】:2020-03-20 04:18:28
【问题描述】:
您好,我昨天解决了一个问题,但又出现了。
我尝试使用一个函数在我的 vue 页面之间进行路由。
routes.js
import Page from '../components/Page'
const routes = {
Page
}
export const vue = routes
Navigator.js
import { topmost } from 'tns-core-modules/ui/frame'
function navigateTo (page) {
topmost().currentPage.__vuePageRef__.$navigateTo(page)
}
export { navigateTo }
Vue 页面:
import {navigateTo} from "../router/navigator";
created: function() {
navigateTo(routes.vue.Page);
}
但它给我带来了错误
System.err: TypeError: Cannot read property 'currentPage' of undefined
我记得我昨天通过将 navigateTo 'function' 更改为 'default function' 解决了这个问题。
但这一次它给我抛出了一个错误,叫做:
System.err: TypeError: Object(...) is not a function
当我通过 routes.vue.Page
感谢您的帮助。
【问题讨论】:
标签: javascript nativescript-vue