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

40 lines
730 B
Vue
Raw Normal View History

2023-07-24 10:05:07 +08:00
<template>
<a-input-number
v-if="type === 'number'"
:style="{ width: '80px' }"
size="small"
2023-07-27 18:48:15 +08:00
:default-value="defaultValue"
2023-07-24 10:05:07 +08:00
@change="handleChange"
/>
<a-switch
v-else
2023-07-27 18:48:15 +08:00
:default-checked="defaultValue"
2023-07-24 10:05:07 +08:00
size="small"
@change="handleChange"
/>
</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>