东软实训


生命周期

<h1>通俗来说,所谓的生命周期就是一些特殊的函数</h1> <h2>现在只记了8个钩子,还有3个钩子在路由那一部分</h2> <h2>其中最重要的为mounted()</h2> <h2>Vue完成模板的解析并把初始的真实DOM放入页面后(挂载完毕)调用mounted</h2> <h2>mounted只会被调用一次</h2> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=cc92a9bd5f7d747f7d752bea976e5838&amp;amp;file=file.png" alt="" /></p> <h2>这些特殊的函数成为生命周期函数,生命周期回调函数,生命周期钩子</h2> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=3da3cd2133cb33aa47819be7ddd5975f&amp;amp;file=file.png" alt="" /></p> <h1>生命周期总共分为四个阶段</h1> <h2>1.创建 beforeCreate created</h2> <h2>2.挂载 beforeMount mounted</h2> <h2>3.更新 beforeUpdate updated</h2> <h2>4.销毁 beforeDestroy destroyed</h2> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=5b4dcf049eeea474b855acd5118bf7e4&amp;amp;file=file.png" alt="" /></p> <h1>&lt;center&gt;生命周期图示&lt;/center&gt;</h1> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=03af3d559af5cff4f8a96f21461f64b0&amp;amp;file=file.png" alt="" /> <img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=f2c9dc05d5b050f380ea5f77c4906b1e&amp;amp;file=file.png" alt="" /></p> <h2>挂载流程</h2> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=ba05f62b86ad0d90ebd83bc1c74dcca2&amp;amp;file=file.png" alt="" /></p> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=2d5cf12fc7f3e9b462c8eaed0f97f055&amp;amp;file=file.png" alt="" /></p> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=07bf9e32117b24c884d25424d90c5f6d&amp;amp;file=file.png" alt="" /></p> <h2>更新流程</h2> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=812cd4c957f1581044b5614b0136bc61&amp;amp;file=file.png" alt="" /></p> <h2>销毁流程</h2> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=52e6e24102f07bc63f9f9ec4b3124ec2&amp;amp;file=file.png" alt="" /></p> <h2>在beforeDestroy()里可以调用方法,可以用数据,但是对数据进行的操作不会实现</h2> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=767fba8985a0493610876ecb71399c2a&amp;amp;file=file.png" alt="" /></p>

页面列表

ITEM_HTML