web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. seo教程
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站

vue3生命周期函数介绍

391 ℃
     

vue3语法中有哪些生命周期函数,下面web建站小编给大家简单介绍一下各种生命周期函数!

生命周期函数代码如下:

//创建前
beforeCreate() {
  console.log('beforeCreate')
},

//创建后
created() {
  console.log('created')
},

//挂载前
beforeMount() {
  console.log('beforeMount')
},

//挂载后
mounted() {
  console.log('mounted')
},

//更新前
beforeUpdate() {
  console.log('beforeUpdate')
},

//更新后
updated() {
  console.log('updated')
},

//销毁前
beforeDestroy() {
  console.log('beforeDestroy')
},

//销毁后
destroyed() {
  console.log('destroyed')
},

vue2与vue3在生命周期的区别:

vue2 vue3
beforeCreate setup() 开始创建组件之前,创建的是data和method
created setup()
beforeMount onBeforeMount 组件挂载到节点上之前执行的函数。
mounted onMounted 组件挂载完成后执行的函数
beforeUpdate onBeforeUpdate 组件更新之前执行的函数。
updated onUpdated 组件更新完成之后执行的函数。
beforeDestroy onBeforeUnmount 组件挂载到节点上之前执行的函数。
destroyed onUnmounted 组件卸载之前执行的函数。

Element UI中文官网Element Plus是一套基于Vue3.0的桌面端组件库

vue3项目如何正确引入新版高德地图(完整代码)

vue3如何解决store.state.count错误的取值

vue3相对于vue2有哪些新特性?

vue2和vue3的5大不同点介绍

标签: vue3, 生命周期

上面是“vue3生命周期函数介绍”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_3197.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > vuejs
本文共计706个字,预计阅读时长5分钟
生活小工具,收录了80多款小工具
上一篇: 抖音联合方正打造免费可商用品牌字体——抖音美好体
下一篇: 推荐一个在线图文转视频、AI 数字人工具——一帧秒创(免费赠送100分钟)
x 打工人ai神器