Files
orion-visor/orion-ops-ui/src/components/global-setting/form-wrapper.vue

38 lines
840 B
Vue
Raw Normal View History

2023-07-24 10:05:07 +08:00
<template>
2023-09-25 22:05:48 +08:00
<a-input-number v-if="type === 'number'"
:style="{ width: '80px' }"
size="small"
:default-value="defaultValue as number"
@change="handleChange"
hide-button
2023-07-24 10:05:07 +08:00
/>
2023-09-25 22:05:48 +08:00
<a-switch v-else
:default-checked="defaultValue"
size="small"
@change="handleChange" />
2023-07-24 10:05:07 +08:00
</template>
<script lang="ts" setup>
const props = defineProps({
type: {
type: String,
default: '',
},
name: {
type: String,
default: '',
},
defaultValue: {
type: [String, Boolean, Number],
default: '',
},
});
const emit = defineEmits(['inputChange']);
const handleChange = (value: unknown) => {
emit('inputChange', {
value,
key: props.name,
});
};
</script>