How to use activated and deactivated in vue composition api?

Viewed 2267

How to use activated and deactivated keep alive events in a vue composition api?

I can't find any references in the docs

1 Answers

for the vue composition api - you can still access the activated/deactivated lifecycle methods in vue, including within vue-next.

vue.js 3/(beta)


I believe the library vue-composition-api supports the activated/deactivated methods but isn't added to the docs.

vue-composition-api

import {onActivated, onDeactivated} from "vue"

export default {
  setup() {
    onActivated(() => {
      // ... 
    })
    onDeactivated(() => {
      // ... 
    })
  }
}
Related