commit
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
* @Author: Ruin 🍭
|
* @Author: Ruin 🍭
|
||||||
* @Date: 2022-03-10 10:11:06
|
* @Date: 2022-03-10 10:11:06
|
||||||
* @LastEditors: 刘引
|
* @LastEditors: 刘引
|
||||||
* @LastEditTime: 2022-03-10 11:56:34
|
* @LastEditTime: 2022-03-10 13:02:31
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="root-home">
|
<div class="root-home">
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onBeforeMount, onMounted, onUnmounted, onUpdated, reactive, ref } from 'vue';
|
import { onBeforeMount, onDeactivated, onMounted, onUpdated, reactive, ref } from 'vue';
|
||||||
let res = ref('我是响应式数据')
|
let res = ref('我是响应式数据')
|
||||||
let moreRes = reactive([{ title: '我是复杂数据' }, { title: '我是复杂数据' }, { title: '我是复杂数据' }])
|
let moreRes = reactive([{ title: '我是复杂数据' }, { title: '我是复杂数据' }, { title: '我是复杂数据' }])
|
||||||
const getData = () => {
|
const getData = () => {
|
||||||
@@ -32,24 +32,18 @@ const changeData = () => {
|
|||||||
console.log('触发');
|
console.log('触发');
|
||||||
}
|
}
|
||||||
// localStorage.setItem('key', res)
|
// localStorage.setItem('key', res)
|
||||||
// dom结构还未完成渲染
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
console.log('触发');
|
console.log('dom渲染之前触发');
|
||||||
|
|
||||||
})
|
})
|
||||||
// dom结构渲染完成
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log('dom渲染完毕');
|
console.log('dom渲染完毕时触发')
|
||||||
|
|
||||||
})
|
})
|
||||||
// 在界面数据更改时会触发
|
|
||||||
onUpdated(() => {
|
onUpdated(() => {
|
||||||
console.log('触发');
|
console.log('在界面数据更改时会触发');
|
||||||
|
|
||||||
})
|
})
|
||||||
onUnmounted(() => {
|
onDeactivated(() => {
|
||||||
// res.value = '我的值被更改'
|
console.log('组件销毁时触发');
|
||||||
// console.log(res.value);
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user