acongm
Vue

Vue

响应式、编译与 Vue 2/3 对比

本模块收录 Vue 相关笔记与实战记录,请从左侧目录选择具体章节。

在父组件中监听子组件的生命周期钩子

<template>
  <child @hook:mounted="onChildMounted"></child>
</template>
<script>
export default {
  methods: {
    onChildMounted() {}
  }
}
</script>

相关源码

在 methods 中使用 debounce / throttle

<template>
  <div class="container" @click="handleClick"></div>
</template>
<script>
import { debounce } from 'lodash-es'
export default {
  methods: {
    handleClick: debounce(function () {}, 500)
  }
}
</script>

官网例子

On this page