mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 09:45:13 +00:00
Migrate settings dialog to Vue (#335)
* Basic setting dialog * Add custom setting value render * handle combo options * Add input slider * 100% width for select dropdown
This commit is contained in:
58
src/components/dialog/content/setting/InputSlider.vue
Normal file
58
src/components/dialog/content/setting/InputSlider.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div class="input-slider">
|
||||
<Slider
|
||||
:modelValue="modelValue"
|
||||
@update:modelValue="updateValue"
|
||||
class="slider-part"
|
||||
:class="sliderClass"
|
||||
v-bind="$attrs"
|
||||
/>
|
||||
<InputText
|
||||
:value="modelValue"
|
||||
@input="updateValue"
|
||||
class="input-part"
|
||||
:class="inputClass"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import InputText from 'primevue/inputtext'
|
||||
import Slider from 'primevue/slider'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: number
|
||||
inputClass?: string
|
||||
sliderClass?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: number): void
|
||||
}>()
|
||||
|
||||
const updateValue = (newValue: string | number) => {
|
||||
const numValue =
|
||||
typeof newValue === 'string' ? parseFloat(newValue) : newValue
|
||||
if (!isNaN(numValue)) {
|
||||
emit('update:modelValue', numValue)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.input-slider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
/* Adjust this value to control space between slider and input */
|
||||
}
|
||||
|
||||
.slider-part {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.input-part {
|
||||
width: 5rem;
|
||||
/* Adjust this value to control input width */
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user