<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>实例生命周期</title>
<script src="./vue.js"></script>
</head>
<body>
<div id="app" @click="tstCl">{{content}}</div>
<script>
var app = new Vue({
el: '#app',
data: {
content:'hallo'
},
template:'<div>{{content}}</div>',
beforeCreate:function () {
console.log('beforeCreate')
},
created:function () {
console.log('created')
},
beforeMount:function () {
console.log('beforemount')
},
mounted:function () {
console.log('mounted')
},
beforeDestroy:function () {
console.log('beforedestory')
},
destroyed:function () {
console.log('destroyed')
},
beforeUpdate:function () {
console.log('beforeupadre')
},
updated:function () {
console.log('updated')
},
methods: {
tstCl:()=>{
alert(this)
}
},
})
</script>
</body>
</html>
vue 的生命周期理解步骤
最新推荐文章于 2024-06-05 10:40:28 发布