Skip to content

topmost() is undefined #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rushairer opened this issue Aug 18, 2019 · 6 comments
Closed

topmost() is undefined #9

rushairer opened this issue Aug 18, 2019 · 6 comments

Comments

@rushairer
Copy link

rushairer commented Aug 18, 2019

The page is set to defaultRoute

import * as frameModule from 'tns-core-modules/ui/frame'

...


mounted() {
        console.log(frameModule.topmost())


....

frameModule.topmost()
I got 'undefined'

If not a defaultRoute page, just use this.$navigator.navigate open it,
topmost is not 'undefined' now.

@rigor789
Copy link
Member

rigor789 commented Sep 7, 2019

Can you describe your issue in more detail, steps to reproduce or a sample that shows the issue?

@rushairer
Copy link
Author

Example:

main.js

import Vue from 'nativescript-vue'
import App from './App'
import Navigator from 'nativescript-vue-navigator'
import { routes } from './routes'

...
...

// setup routes
Vue.use(Navigator, { routes })

new Vue({
    store,
    render: h => h(App)
}).$start()

App.vue

<template>
    <Navigator class="ns-dark" :defaultRoute="'/welcome'" />
</template>
<script>
...
</script>

Welcome.vue

...
import * as frameModule from 'tns-core-modules/ui/frame'

...


mounted() {
        console.log(frameModule.topmost())


...

console.log(frameModule.topmost()) got undefined

@darrenkhouston
Copy link

darrenkhouston commented Nov 4, 2019

@rushairer I am also using this plugin and I am able to reference topmost() by importing it as its own module.

import { topmost } from "tns-core-modules/ui/frame"

Then I can reference it below as
mounted() { console.log(topmost()); }

@rushairer
Copy link
Author

@darrenkhouston Thanks, I will try it.

@darrenkhouston
Copy link

darrenkhouston commented Nov 14, 2019

@rushairer sure thing. Should also note that calling topmost() directly is deprecated, so
import { Frame } from "tns-core-modules/ui/frame" and then calling
mounted() { console.log(Frame.topmost()); } is probably the recommended way to do it.

@rushairer
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants