feat: 字典功能
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
|
||||
import { Button, Card } from 'ant-design-vue';
|
||||
import { Button, Card, Select } from 'ant-design-vue';
|
||||
|
||||
import { DictTag } from '#/components/Dict';
|
||||
import { useDictStore } from '#/store/dict';
|
||||
import { getDict, getDictOptions } from '#/utils/dict';
|
||||
|
||||
onMounted(() => {
|
||||
console.log('keepAlive测试 -> 挂载了');
|
||||
@@ -17,10 +21,19 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => intervalId && clearInterval(intervalId));
|
||||
|
||||
const sexOptions = getDictOptions('sys_user_sex');
|
||||
const disabledDict = getDict('sys_normal_disable');
|
||||
|
||||
const dictStore = useDictStore();
|
||||
onMounted(() => {
|
||||
console.log(dictStore.dictMap);
|
||||
console.log(dictStore.dictOptionsMap);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="m-[8px]">
|
||||
<div class="m-[16px] flex flex-col gap-[16px]">
|
||||
<Card title="测试keepAlive">
|
||||
<template #extra>
|
||||
<Button type="primary" v-access:code="['system:user:list']">
|
||||
@@ -29,5 +42,16 @@ onBeforeUnmount(() => intervalId && clearInterval(intervalId));
|
||||
</template>
|
||||
<p>当前计数: {{ count }}</p>
|
||||
</Card>
|
||||
<Card title="字典测试">
|
||||
<div class="flex items-center gap-[16px]">
|
||||
<Select
|
||||
:options="sexOptions"
|
||||
class="w-[200px]"
|
||||
placeholder="请选择性别"
|
||||
/>
|
||||
<DictTag :dicts="disabledDict" value="0" />
|
||||
<DictTag :dicts="disabledDict" value="1" />
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user