admin-vben5/apps/web-antd/src/views/system/user/index.vue

34 lines
730 B
Vue
Raw Normal View History

2024-08-07 08:57:56 +08:00
<script setup lang="ts">
2024-08-08 08:53:05 +08:00
import { onBeforeUnmount, onMounted, ref } from 'vue';
2024-08-07 08:57:56 +08:00
2024-08-08 08:53:05 +08:00
import { Button, Card } from 'ant-design-vue';
2024-08-07 08:57:56 +08:00
onMounted(() => {
console.log('keepAlive测试 -> 挂载了');
});
2024-08-08 08:53:05 +08:00
const count = ref(0);
let intervalId: number = 0;
onMounted(() => {
intervalId = setInterval(() => {
count.value++;
}, 1000);
});
onBeforeUnmount(() => intervalId && clearInterval(intervalId));
2024-08-07 08:57:56 +08:00
</script>
<template>
<div class="m-[8px]">
2024-08-08 08:53:05 +08:00
<Card title="测试keepAlive">
<template #extra>
<Button type="primary" v-access:code="['system:user:list']">
测试按钮权限system:user:list
</Button>
</template>
<p>当前计数: {{ count }}</p>
</Card>
2024-08-07 08:57:56 +08:00
</div>
</template>