unknown 8 months ago
parent
commit
8df936d5cd
5 changed files with 32 additions and 27 deletions
  1. 15 11
      index.html
  2. BIN
      public/logo.png
  3. 7 11
      src/components/drag/resizable.vue
  4. 2 2
      src/module/index.ts
  5. 8 3
      src/views/HomeView.vue

+ 15 - 11
index.html

@@ -1,13 +1,17 @@
 <!doctype html>
 <html lang="en">
-  <head>
-    <meta charset="UTF-8" />
-    <link rel="icon" type="image/svg+xml" href="/logo.png" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>面板工作台</title>
-  </head>
-  <body>
-    <div id="app"></div>
-    <script type="module" src="/src/main.ts"></script>
-  </body>
-</html>
+
+<head>
+  <meta charset="UTF-8" />
+  <!-- <link rel="icon" type="image/svg+xml" href="/public/logo.png" /> -->
+  <link rel="icon" type="image/svg+xml" href="/logo.png" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+  <title>面板工作台</title>
+</head>
+
+<body>
+  <div id="app"></div>
+  <script type="module" src="/src/main.ts"></script>
+</body>
+
+</html>

BIN
public/logo.png


+ 7 - 11
src/components/drag/resizable.vue

@@ -1,8 +1,9 @@
 <template>
-    <Vue3DraggableResizable :initW="initW" :initH="initH" v-model:x="top" v-model:y="left" v-model:w="w" v-model:h="h"
-        :active="active" :handles="sticks" :draggable="true" :resizable="true" :prevent-deactivation="true"
-        @drag-start="print('drag-start')" @resize-start="print('resize-start')" @dragging="print('dragging')"
-        @resizing="print('resizing')" @drag-end="print('drag-end')" @resize-end="print('resize-end')">
+    <Vue3DraggableResizable :prevent-deactivation="true" classNameActive="active" :initW="initW" :initH="initH"
+        v-model:x="top" v-model:y="left" v-model:w="w" v-model:h="h" v-model:active="active" :handles="sticks"
+        :draggable="true" :resizable="true" @drag-start="print('drag-start')" @resize-start="print('resize-start')"
+        @dragging="print('dragging')" @resizing="print('resizing')" @drag-end="print('drag-end')"
+        @resize-end="print('resize-end')">
         <component :is="getWidget(currentItem.type)" :config="currentItem"></component>
     </Vue3DraggableResizable>
 </template>
@@ -24,7 +25,6 @@ const isResizable = ref(false)
 const sticks = ref([])
 const active = ref(true)
 const currentItem: any = ref({})
-
 const porps = defineProps({
     dargData: {
         type: Object,
@@ -43,7 +43,7 @@ console.log(initW.value, initH.value, w.value, h.value, top.value, left.value, '
 
 isResizable.value = arrData.config.isResizable
 sticks.value = arrData.config.sticks
-// active.value = arrData.active
+active.value = arrData.active
 
 function print(val) {
     currentItem.value.css.width = w.value
@@ -58,8 +58,4 @@ const getWidget = (name: string) => {
 }
 </script>
 
-<style lang="scss" scoped>
-:deep(.vdr-container.active) {
-    overflow: hidden;
-}
-</style>
+<style lang="scss" scoped></style>

+ 2 - 2
src/module/index.ts

@@ -7,7 +7,7 @@ const attributeValue = [{
     config: configList1,
     css: cssList1,
 }, {
-    id: 2, type: 'SceneButton', name: "场景", active: false,
+    id: 2, type: 'SceneButton', name: "场景1", active: false,
     config: btnConfig,
     css: btnCss,
 }]
@@ -17,7 +17,7 @@ const layout = [{
     config: configList1,
     css: cssList1,
 }, {
-    id: 4, type: 'SceneButton', name: "场景", active: false,
+    id: 4, type: 'SceneButton', name: "场景2", active: false,
     config: btnConfig,
     css: btnCss,
 }]

+ 8 - 3
src/views/HomeView.vue

@@ -17,7 +17,7 @@
         </div>
       </div>
       <div class="nav_right">
-        <div class="card_right_btn">
+        <div class="card_right_btn" @click="preview">
           <div class="card_btn_item"><el-icon :size="18">
               <View />
             </el-icon></div>
@@ -70,7 +70,7 @@
         <div class="card_home">
           <img class="head_image_url" :src="imageUrl" />
           <div class="Bzu">
-            <DraggableContainer :prevent-deactivation="false">
+            <DraggableContainer>
               <draggable class="Bzu" v-model="extraImgs1" itemKey="id" :force-fallback="false" :sort="false"
                 :handle="'forbid'" :fallbackOnBody="false" :group="{ name: 'undraggable', pull: false, put: true }"
                 @start="onStart" @end="onEnd">
@@ -151,7 +151,7 @@ function getAssetsImages(name) {
 }
 
 const extraImgs = ref(attributeValue);
-const extraImgs1 = ref([]);
+const extraImgs1:any = ref([]);
 const state = ref({
   message: "拖拽",
   groupA: {
@@ -201,6 +201,11 @@ function announce() {
   console.log(extraImgs1.value, 999);
 }
 
+function preview() {
+  console.log(extraImgs1.value[0],887);
+  extraImgs1.value[0].active = true
+  extraImgs1.value = extraImgs1.value
+}
 </script>
   
 <style lang="scss" scoped>