chore: keepAlive测试
This commit is contained in:
parent
75689766e7
commit
ac7e7beeda
@ -1,17 +1,33 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted } from 'vue';
|
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button, Card } from 'ant-design-vue';
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log('keepAlive测试 -> 挂载了');
|
console.log('keepAlive测试 -> 挂载了');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const count = ref(0);
|
||||||
|
let intervalId: number = 0;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
intervalId = setInterval(() => {
|
||||||
|
count.value++;
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => intervalId && clearInterval(intervalId));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="m-[8px]">
|
<div class="m-[8px]">
|
||||||
<Button type="primary" v-access:code="['system:user:list']">
|
<Card title="测试keepAlive">
|
||||||
测试按钮可见
|
<template #extra>
|
||||||
</Button>
|
<Button type="primary" v-access:code="['system:user:list']">
|
||||||
|
测试按钮权限system:user:list
|
||||||
|
</Button>
|
||||||
|
</template>
|
||||||
|
<p>当前计数: {{ count }}</p>
|
||||||
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user