|
@@ -1,11 +1,45 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<h1>生命周期</h1>
|
|
|
+ <p>{{ msg }}</p>
|
|
|
+ <button @click="changeMain">修改</button>
|
|
|
+ <!--
|
|
|
+
|
|
|
+ -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script lang="ts" setup>
|
|
|
-
|
|
|
+<script>
|
|
|
+ export default{
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ msg:"你好"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ changeMain() {
|
|
|
+ this.msg = 'hello'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeCreate() {
|
|
|
+ console.log(this.msg,'创建前',this.changeMain,this.$el)
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ console.log(this.msg,'创建后',this.changeMain,this.$el)
|
|
|
+ },
|
|
|
+ beforeMount() {
|
|
|
+ console.log(this.msg,'挂载前',this.changeMain,this.$el)
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ console.log(this.msg,'挂载后',this.changeMain,this.$el)
|
|
|
+ },
|
|
|
+ beforeUpdate(){
|
|
|
+ console.log(this.msg,'更新前',this.changeMain,this.$el,document.querySelector("p").innerHTML)
|
|
|
+ },
|
|
|
+ updated() {
|
|
|
+ console.log(this.msg,'更新后',this.changeMain,this.$el,document.querySelector("p").innerHTML)
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|