gerson
2024-09-07 37179a65229455f540dc3ca62d31c4716e15d12d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<template>
    <div class="flex items-center">
        <el-input-number
            placeholder="最小值"
            :style="{
                width: inputWidth,
            }"
            class="rounded-full"
            v-model="yRange.min"
            @input="(val) => numInput(val, 'min')"
            :controls="false"
        ></el-input-number>
        <span class="bg-[#cdcdcd] h-[32px] inline-block flex-center">~</span>
        <el-input-number
            placeholder="最大值"
            :style="{
                width: inputWidth,
            }"
            class="round"
            v-model="yRange.max"
            :controls="false"
            @input="(val) => numInput(val, 'max')"
        ></el-input-number>
    </div>
</template>
 
<script setup lang="ts">
import { watch, type PropType, ref } from 'vue';
 
const emit = defineEmits(['input']);
 
const yRange = ref({
    min: null,
    max: null,
});
 
const realYRange = ref({
    min:null,
    max:null
})
const inputWidth = '82px';
 
const numInput = (val: any, type: 'min' | 'max') => {
    realYRange.value[type] = val;
    emit('input', realYRange.value);
};
</script>
<style scoped lang="scss"></style>