mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-05-11 21:42:09 +08:00
fix: demo validator usage & types import
This commit is contained in:
@@ -15,12 +15,13 @@ const modelValue = defineModel('value');
|
||||
const finalOption = computed(() => {
|
||||
const { type, ...otherOption } = props.data.option;
|
||||
|
||||
if (type === 'number') {
|
||||
if (type === 'number' || type === 'exponential') {
|
||||
return {
|
||||
step: props.data.option.step ?? 1,
|
||||
min: props.data.option.min,
|
||||
max: props.data.option.max,
|
||||
precision: props.data.option.precision ?? 0,
|
||||
...otherOption,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,10 @@ const bodyStyle = computed(() => {
|
||||
});
|
||||
|
||||
function init() {
|
||||
if (!modelValue.value) {
|
||||
modelValue.value = {};
|
||||
}
|
||||
|
||||
for (const param of props.params) {
|
||||
modelValue.value[param.key] = param.defaultValue ?? null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { CollapsibleRootEmits, CollapsibleRootProps } from 'reka-ui';
|
||||
|
||||
import type { ClassType } from '@vben-core/typings';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { ChevronsDown } from 'lucide-vue-next';
|
||||
|
||||
@@ -4,11 +4,11 @@ export interface CollapsibleParamOption {
|
||||
min?: number;
|
||||
precision?: number;
|
||||
step?: number;
|
||||
type: 'exponential' | 'number' | 'select' | 'string';
|
||||
type?: 'exponential' | 'number' | 'select' | 'string';
|
||||
}
|
||||
|
||||
export interface CollapsibleParamSchema {
|
||||
defaultValue: number | number[] | string | string[];
|
||||
defaultValue?: number | number[] | string | string[];
|
||||
description: string;
|
||||
key: string;
|
||||
option: CollapsibleParamOption;
|
||||
|
||||
Reference in New Issue
Block a user