mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat: 新增菜单管理页面
This commit is contained in:
24
src/components/common/boolean-tag.vue
Normal file
24
src/components/common/boolean-tag.vue
Normal file
@ -0,0 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import type { TagProps } from 'naive-ui';
|
||||
import { useAttrs } from 'vue';
|
||||
import { isNotNull } from '@/utils/common';
|
||||
|
||||
defineOptions({
|
||||
name: 'BooleanTag'
|
||||
});
|
||||
|
||||
const value = defineModel<'0' | '1'>('value', { required: true });
|
||||
|
||||
const tagMap: Record<'0' | '1', NaiveUI.ThemeColor> = {
|
||||
0: 'success',
|
||||
1: 'error'
|
||||
};
|
||||
|
||||
const attrs: TagProps = useAttrs();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NTag v-if="isNotNull(value)" :type="tagMap[value]" v-bind="attrs">{{ value === '0' ? '是' : '否' }}</NTag>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
31
src/components/common/status-tag.vue
Normal file
31
src/components/common/status-tag.vue
Normal file
@ -0,0 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
import type { TagProps } from 'naive-ui';
|
||||
import { useAttrs } from 'vue';
|
||||
import { enableStatusRecord } from '@/constants/business';
|
||||
import { isNotNull } from '@/utils/common';
|
||||
|
||||
defineOptions({
|
||||
name: 'StatusTag'
|
||||
});
|
||||
|
||||
interface Props {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
defineProps<Props>();
|
||||
|
||||
const status = defineModel<Api.Common.EnableStatus>('value', { required: true });
|
||||
|
||||
const tagMap: Record<Api.Common.EnableStatus, NaiveUI.ThemeColor> = {
|
||||
'0': 'success',
|
||||
'1': 'warning'
|
||||
};
|
||||
|
||||
const attrs: TagProps = useAttrs();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NTag v-if="isNotNull(status)" :type="tagMap[status]" v-bind="attrs">{{ enableStatusRecord[status] }}</NTag>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
Reference in New Issue
Block a user