vhook

useLifecycles


同时使用 onMountedonUnmountedHook

API

useLifecycles(onMountedCb, onUnmountedCb)

Params

参数名描述类型默认值
onMountedCbonMounted 时的回调() => any
onUnmountedCbonUnmounted 时的回调() => any

Example

Code

<script>
  import { useLifecycles } from 'vhook'
  export default {
    setup () {
      useLifecycles(
        () => console.log('mounted'),
        () => console.log('unmounted')
      )
    }
  }
</script>