DEV Community

Meyti
Meyti

Posted on

Handle page unload event in nativescript-vue

import { Page } from 'tns-core-modules/ui/page'
export default {
  mounted () {
    this.nativeView.page.on(Page.navigatingFromEvent, this.pageUnload)
  },
  beforeDestory () {
    this.nativeView.page.off(Page.navigatingFromEvent, this.pageUnload)
  },
  methods: {
    pageUnload () {
      console.log('page unload')
    }
  }
}

Top comments (0)