Browse Source

可固定对话框宽度

Michael Wang 3 years ago
parent
commit
9945293886
2 changed files with 7 additions and 2 deletions
  1. 5 1
      src/components/QmDialog.vue
  2. 2 1
      src/features/mark/MarkBoardTrackDialog.vue

+ 5 - 1
src/components/QmDialog.vue

@@ -51,6 +51,7 @@ const {
   title = "无标题",
   zIndex = 1020,
   enableResize = true,
+  fixedWidth = false,
 } = defineProps<{
   title: string;
   top?: string;
@@ -58,6 +59,7 @@ const {
   height?: string;
   zIndex?: number;
   enableResize?: boolean;
+  fixedWidth?: boolean;
 }>();
 
 defineEmits(["close"]);
@@ -139,7 +141,9 @@ const handleResizeMouseMove = (e: MouseEvent) => {
   const { clientX, clientY } = e;
   const newXRatio = clientX - mousePosition.offsetX;
   const newYRatio = clientY - mousePosition.offsetY;
-  positionStyle.width = parseFloat(positionStyle.width) + newXRatio + "px";
+  positionStyle.width = fixedWidth
+    ? width
+    : parseFloat(positionStyle.width) + newXRatio + "px";
   positionStyle.height = parseFloat(positionStyle.height) + newYRatio + "px";
 
   mousePosition.offsetX = clientX;

+ 2 - 1
src/features/mark/MarkBoardTrackDialog.vue

@@ -3,7 +3,8 @@
     v-if="store.isScoreBoardCollapsed"
     title="给分板"
     top="10%"
-    width="700px"
+    width="290px"
+    fixed-width
     height="400px"
     @close="close"
   >