|
@@ -33,13 +33,15 @@
|
|
|
|
|
|
<div class="controls">
|
|
<div class="controls">
|
|
<div class="label">{{ modelValue }}</div>
|
|
<div class="label">{{ modelValue }}</div>
|
|
-<!-- <button @click="reset">重置</button>-->
|
|
|
|
|
|
+
|
|
|
|
+ <RefreshIcon class="resetIcon hover" @click="reset"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { ref, watch, computed, onMounted, onBeforeUnmount } from 'vue'
|
|
import { ref, watch, computed, onMounted, onBeforeUnmount } from 'vue'
|
|
|
|
+import {RefreshIcon} from "tdesign-icons-vue-next";
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
modelValue: String,
|
|
modelValue: String,
|
|
@@ -112,8 +114,12 @@ function onMouseUp() {
|
|
const reset = () => {
|
|
const reset = () => {
|
|
p1.value = { x: 0.25, y: 0.75 }
|
|
p1.value = { x: 0.25, y: 0.75 }
|
|
p2.value = { x: 0.75, y: 0.25 }
|
|
p2.value = { x: 0.75, y: 0.25 }
|
|
- emit('update:modelValue', formatVal())
|
|
|
|
- emit('reset',formatVal())
|
|
|
|
|
|
+
|
|
|
|
+ const updatedValue = formatVal();
|
|
|
|
+
|
|
|
|
+ emit('update:modelValue', updatedValue); // 更新v-model值
|
|
|
|
+ emit('reset', updatedValue); // 触发重置事件(如果有其他监听器)
|
|
|
|
+ emit('change', updatedValue)
|
|
}
|
|
}
|
|
function onSvgMouseDown(e) {
|
|
function onSvgMouseDown(e) {
|
|
if (!svg.value) return
|
|
if (!svg.value) return
|
|
@@ -171,20 +177,8 @@ onBeforeUnmount(() => {
|
|
}
|
|
}
|
|
.controls {
|
|
.controls {
|
|
display: flex;
|
|
display: flex;
|
|
- gap: 12px;
|
|
|
|
|
|
+ width: 100%;
|
|
|
|
+ justify-content: space-between;
|
|
align-items: center;
|
|
align-items: center;
|
|
}
|
|
}
|
|
-
|
|
|
|
-button {
|
|
|
|
- padding: 4px 10px;
|
|
|
|
- font-size: 12px;
|
|
|
|
- border: 1px solid #aaa;
|
|
|
|
- background: #f3f3f3;
|
|
|
|
- cursor: pointer;
|
|
|
|
- border-radius: 4px;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-button:hover {
|
|
|
|
- background: #e0e0e0;
|
|
|
|
-}
|
|
|
|
</style>
|
|
</style>
|