Fix: 调整文件结构 & 隐藏垂直滚动条 & 修正Tauri构建错误
This commit is contained in:
36
src/components/ParamInputField.vue
Normal file
36
src/components/ParamInputField.vue
Normal file
@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<v-text-field
|
||||
density="compact"
|
||||
hide-details
|
||||
:label="label"
|
||||
:model-value="modelValue.value.toString()"
|
||||
:suffix="modelValue.unit"
|
||||
type="number"
|
||||
variant="outlined"
|
||||
@update:model-value="handleUpdate"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Param } from '@/types/param'
|
||||
|
||||
interface Props {
|
||||
label: string
|
||||
modelValue: Param
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
(e: 'update:modelValue', value: Param): void
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const emit = defineEmits<Emits>()
|
||||
|
||||
function handleUpdate (value: string) {
|
||||
const numValue = value === '' ? 0 : Number.parseFloat(value)
|
||||
emit('update:modelValue', {
|
||||
value: numValue,
|
||||
unit: props.modelValue.unit,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user