Skip to content

vue 组件使用

仲灏约 1 分钟

vue 组件使用

代码参考 vue-demo ComponentsDemo

  • props 类型和默认值
  • $emit 执行父组件的事件
  • vue 自带 eventBus 功能

单个组件生命周期

vue 生命周期

  • 挂载过程
  • 更新过程
  • 销毁过程

考虑父子组件的生命周期,参考代码中 index 和 List 组件。

创建阶段

  • index created
  • list created
  • list mounted
  • index mounted

更新阶段

  • index before update
  • list before update
  • list updated
  • index updated

销毁阶段

  • index before destroy
  • list before destroy
  • list destroyed
  • index destroyed

上次更新:

讨论区

欢迎留下想法与补充