useLifecycles
同时使用 onMounted
和 onUnmounted
的 Hook
API
useLifecycles(onMountedCb, onUnmountedCb)
Params
参数名 | 描述 | 类型 | 默认值 |
---|---|---|---|
onMountedCb | onMounted 时的回调 | () => any | |
onUnmountedCb | onUnmounted 时的回调 | () => any |
Example
Code
<script>
import { useLifecycles } from 'vhook'
export default {
setup () {
useLifecycles(
() => console.log('mounted'),
() => console.log('unmounted')
)
}
}
</script>