略略略略略略略略略略略略

This commit is contained in:
李志鹏
2026-01-08 14:29:10 +08:00
parent 567ae02c48
commit 4e0faed88e
17 changed files with 229 additions and 152 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="angle-tool">
<div class="angle-tool" :disabled="disabled">
<div
ref="dishRef"
class="dish"
@@ -11,7 +11,13 @@
</div>
</div>
<div class="input">
<input type="number" v-model="angle" @input="onInput" @change="onChange" />
<input
type="number"
v-model="angle"
@input="onInput"
@change="onChange"
:disabled="disabled"
/>
</div>
</div>
</template>
@@ -25,14 +31,22 @@
type: Number,
default: 0,
},
disabled: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["change", "input"]);
const angle = ref(props.angle);
watch(() => props.angle, (value) => {
angle.value = value;
});
watch(
() => props.angle,
(value) => {
angle.value = value;
}
);
const dishRef = ref<HTMLDivElement>();
const mousedown = (e: MouseEvent | TouchEvent) => {
if (props.disabled) return;
const mousemove = (e: MouseEvent | TouchEvent) => {
if (!dishRef.value) return;
const { left, top, width, height } =
@@ -56,9 +70,10 @@
document.addEventListener("mouseup", mouseup);
document.addEventListener("touchend", mouseup);
};
const onInput = () => emit("input", angle.value);
const onInput = () => !props.disabled && emit("input", angle.value);
var changeTime: any = null;
const onChange = () => {
if (props.disabled) return;
clearTimeout(changeTime);
changeTime = setTimeout(() => emit("change", angle.value), 500);
};
@@ -79,10 +94,17 @@
display: flex;
align-items: center;
width: 100%;
--color: #000;
&[disabled="true"] {
--color: #b2b2b2;
> .dish {
cursor: not-allowed;
}
}
> .dish {
width: 24px;
height: 24px;
border: 1px solid #000;
border: 1px solid var(--color);
border-radius: 50%;
cursor: pointer;
> .pointer {
@@ -98,7 +120,7 @@
transform: translate(-50%, 0);
width: 35%;
height: 35%;
background-color: #000;
background-color: var(--color);
border-radius: 50%;
}
}
@@ -106,7 +128,7 @@
> .input {
margin-left: 5px;
font-size: 14px;
color: #000;
color: var(--color);
flex: 1;
// min-width: 45px;
// max-width: 80px;

View File

@@ -5,6 +5,7 @@
@change="change"
:defaultValue="defaultValue"
@dropdownVisibleChange="dropdownVisibleChange"
:disabled="disabled"
>
<a-select-option
v-for="v in list"
@@ -21,6 +22,10 @@
<script setup lang="ts">
import { ref, defineProps, defineEmits, watch } from "vue";
const props = defineProps({
disabled: {
type: Boolean,
default: false,
},
defaultValue: {
default: "",
},

View File

@@ -1,5 +1,5 @@
<template>
<div class="slider">
<div class="slider" :disabled="disabled">
<div class="input-range">
<span
class="tip"
@@ -16,6 +16,7 @@
:step="props.step"
@input="onInput"
@change="onChange"
:disabled="disabled"
/>
</div>
<div class="input" v-show="isInput">
@@ -27,6 +28,7 @@
:step="props.step"
@input="onInput"
@change="onChange"
:disabled="disabled"
/>
</div>
</div>
@@ -35,6 +37,10 @@
<script setup lang="ts">
import { ref, defineProps, defineEmits, watch } from "vue";
const props = defineProps({
disabled: {
type: Boolean,
default: false,
},
value: {
type: Number,
default: 0,
@@ -66,9 +72,10 @@
() => props.value,
(v) => (value.value = v)
);
const onInput = () => emit("input", Number(value.value));
const onInput = () => !props.disabled && emit("input", Number(value.value));
var changeTime: any = null;
const onChange = () => {
if (props.disabled) return;
clearTimeout(changeTime);
changeTime = setTimeout(() => emit("change", Number(value.value)), 500);
};