Vue生命周期
Vue中常見生命周期節(jié)點
- created:組件實例被創(chuàng)建之后調(diào)用终佛。
- mounted:組件掛載到DOM后調(diào)用俐镐。
- updated:組件數(shù)據(jù)更新后調(diào)用纺念。
- destroyed:組件銷毀后調(diào)用栋齿。
例子
<template>
<div class="hello">
<el-row style="margin-top: 10px">
<el-col :span="12">
<span>{{this.outTag()}}</span>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
name: "HelloWorld1",
data() {
return {
};
},
watch: {},
mounted() {
console.log("=====> mounted ");
},
beforeCreate() {
console.log("=====> beforeCreate ");
},
created() {
console.log("=====> created ");
},
methods: {
outTag() {
console.log("=====> outTag method");
}
},
};
</script>
<style scoped></style>
參考
https://cn.vuejs.org/api/composition-api-lifecycle.html
最后編輯于 :
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者