1
0

compass.vue 1016 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <el-form-item label="角度:">
  3. <div class="last-layout">
  4. <el-input-number
  5. :model-value="value || 0"
  6. placeholder="0"
  7. step-strictly
  8. :step="1"
  9. @update:model-value="val => setRotate(val as number, false)"
  10. :min="0"
  11. :max="360"
  12. >
  13. </el-input-number>
  14. <span class="last-t">°</span>
  15. </div>
  16. </el-form-item>
  17. </template>
  18. <script setup lang="ts">
  19. import { ref } from "vue";
  20. import { BoardShape } from "../board";
  21. const props = defineProps<{ shape: BoardShape }>();
  22. const emit = defineEmits<{ (e: "blur"): void }>();
  23. const value = ref<number>(props.shape.data.rotate);
  24. const setRotate = (edg: number, save: boolean) => {
  25. edg = parseInt((edg || 0).toString());
  26. if (edg !== value.value) {
  27. value.value = edg;
  28. props.shape.setRotate(edg, true);
  29. }
  30. };
  31. </script>
  32. <style lang="scss" scoped>
  33. .last-layout {
  34. position: relative;
  35. }
  36. .last-t {
  37. z-index: 1;
  38. position: absolute;
  39. transform: translateX(-40px);
  40. }
  41. </style>