对于 vue 组合 api - 您仍然可以访问activated/deactivated
vue 中的生命周期方法,包括在vue-next
.
vue.js 3/(测试版)
我相信该库vue-composition-api
支持激活/停用方法,但未添加到文档中。
vue-composition-api
import {onActivated, onDeactivated} from "vue"
export default {
setup() {
onActivated(() => {
// ...
})
onDeactivated(() => {
// ...
})
}
}