vue 生命周期

网友投稿 644 2022-11-17

vue 生命周期

vue 生命周期

2021-02-28

import Vue from 'vue'const app = new Vue({ // el: '#root', // template: '

{{text}}
', data: { text: 0 }, // beforeCreate created方法可以在服务端调用 beforeCreate () { console.log(this.$el, 'beforeCreate') }, created () { console.log(this.$el, 'created') }, // beforeMount 和 mounted 是需要Dom有了才操作的 beforeMount () { console.log(this.$el, 'beforeMount') }, mounted () { // 可以做操作dom相关的操作 console.log(this.$el, 'mounted') }, beforeUpdate () { console.log(this, 'beforeUpdate') }, updated () { console.log(this, 'updated') }, activated () { // 在组件章节讲解 console.log(this, 'activated') }, deactivated () { // 在组件章节讲解 console.log(this, 'deactivated') }, beforeDestroy () { console.log(this, 'beforeDestroy') }, destroyed () { console.log(this, 'destroyed') }, render (h) { throw new TypeError('render error') // console.log('render function invoked') // return h('div', {}, this.text) }, renderError (h, err) { // 开发调试的渲染错误显示 return h('div', {}, err.stack) }, errorCaptured () { // 会向上冒泡,并且正式环境可以使用 }})app.$mount('#root')// setInterval(() => {// app.text = app.text += 1// }, 1000)setTimeout(() => { // 解除所有的事件监听和watch app.$destroy()}, 1000)

1.appearance: 'none' 去掉浏览器默认样式

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:k8s和容器那些事!那些关系
下一篇:Docker入门使用
相关文章

 发表评论

暂时没有评论,来抢沙发吧~