mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-04-08 14:37:38 +00:00
重构组件结构,优化导入路径并移除不必要的组件,新增多个模态框组件以支持部门、角色、权限和用户管理功能
This commit is contained in:
42
frontend/src/components/form/FormInput.vue
Normal file
42
frontend/src/components/form/FormInput.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div class="w-full">
|
||||
<label :for="id" class="block mb-2 text-sm font-medium text-gray-900">{{ label }}</label>
|
||||
<input :type="type" :id="id" :name="name" :value="modelValue"
|
||||
@input="$emit('update:modelValue', ($event.target as HTMLInputElement).value)" :placeholder="placeholder"
|
||||
:required="required" :autocomplete="autocomplete" :class="[
|
||||
'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg block w-full p-2.5',
|
||||
error ? 'border-red-500 focus:ring-red-500 focus:border-red-500' : 'focus:ring-blue-500 focus:border-blue-500'
|
||||
]" />
|
||||
<p v-if="error" class="mt-1 text-sm text-red-600">{{ error }}</p>
|
||||
<p v-if="hint && !error" class="mt-1 text-sm text-gray-500">{{ hint }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
/** 输入框标签 */
|
||||
label: string;
|
||||
/** 输入框ID */
|
||||
id: string;
|
||||
/** 输入框名称 */
|
||||
name?: string;
|
||||
/** 输入框类型 */
|
||||
type?: string;
|
||||
/** 输入框占位符 */
|
||||
placeholder?: string;
|
||||
/** 是否必填 */
|
||||
required?: boolean;
|
||||
/** 自动完成属性 */
|
||||
autocomplete?: string;
|
||||
/** 输入框值 */
|
||||
modelValue: string;
|
||||
/** 错误信息 */
|
||||
error?: string;
|
||||
/** 提示信息 */
|
||||
hint?: string;
|
||||
}>();
|
||||
|
||||
defineEmits<{
|
||||
"update:modelValue": [value: string];
|
||||
}>();
|
||||
</script>
|
||||
40
frontend/src/components/form/FormSelect.vue
Normal file
40
frontend/src/components/form/FormSelect.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div class="w-full">
|
||||
<label :for="id" class="block mb-2 text-sm font-medium text-gray-900">{{ label }}</label>
|
||||
<select :id="id" :name="name" :value="modelValue"
|
||||
@change="$emit('update:modelValue', ($event.target as HTMLSelectElement).value)" :required="required" :class="[
|
||||
'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg block w-full p-2.5',
|
||||
error ? 'border-red-500 focus:ring-red-500 focus:border-red-500' : 'focus:ring-blue-500 focus:border-blue-500'
|
||||
]">
|
||||
<option v-if="placeholder" value="" disabled>{{ placeholder }}</option>
|
||||
<slot></slot>
|
||||
</select>
|
||||
<p v-if="error" class="mt-1 text-sm text-red-600">{{ error }}</p>
|
||||
<p v-if="hint && !error" class="mt-1 text-sm text-gray-500">{{ hint }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
/** 选择框标签 */
|
||||
label: string;
|
||||
/** 选择框ID */
|
||||
id: string;
|
||||
/** 选择框名称 */
|
||||
name?: string;
|
||||
/** 选择框占位符 */
|
||||
placeholder?: string;
|
||||
/** 是否必填 */
|
||||
required?: boolean;
|
||||
/** 选择框值 */
|
||||
modelValue: string | number | boolean;
|
||||
/** 错误信息 */
|
||||
error?: string;
|
||||
/** 提示信息 */
|
||||
hint?: string;
|
||||
}>();
|
||||
|
||||
defineEmits<{
|
||||
"update:modelValue": [value: string | number | boolean];
|
||||
}>();
|
||||
</script>
|
||||
Reference in New Issue
Block a user