当前位置: 首页 > news >正文

Vue进阶之Vue无代码可视化项目(五)

Vue无代码可视化项目

  • 编排引擎
    • smooth-dnd
      • LeftPanel.vue
      • LayoutView.vue
      • stores/debug.ts
      • stores/editor.ts
      • AppNavigator.vue
    • 添加-左侧栏添加到中间部分
      • LayoutView.vue
      • store/editor.ts
      • LeftPanel.vue
    • 移动-中间部分区域的位置更改
      • 新建文件夹utils、文件array.ts
        • array.ts
        • LayoutView.vue

编排引擎

smooth-dnd

LeftPanel.vue

 <SmoothDndContainer class="block-group" behaviour="copy"tag="div"  group-name="blocks" @drag-start="(e,v)=>console.log(e,v)" @drag-leave="(e,v)=>console.log(e,v)"@drop="(e)=>console.log('drop',e)":get-child-payload="(index:number)=>index"><SmoothDndDraggable v-for="i in 10" :key="i"><div class="block-item">{{i}}</div></SmoothDndDraggable></SmoothDndContainer>
.block-item{width: 40px;height: 40px;background-color: #fff;border: 1px solid #e8e8e8;margin-bottom: 8px;display: flex;justify-content: center;align-items: center;font-size: 14px;transition:background-color 0.3s;cursor: move;user-select: none;
}.block-group{padding: 8px;display: flex;flex-wrap: wrap;gap: 8px;
}
</style>

全部代码:

<script setup lang="ts">
import {Lightning, Share } from '@icon-park/vue-next'
import { ref } from 'vue';
import {SmoothDndContainer} from '@/components/SmoothDnd/SmoothDndContainer'
import {SmoothDndDraggable} from '@/components/SmoothDnd/SmoothDndDraggable'type Mode = 'outline'|'blocks'|null
const mode = ref<Mode>(null)const toggleMode = (newMode:Mode) => {if(newMode === mode.value){mode.value = null}else{mode.value = newMode}
}
</script><template><div class="left-panel-wrapper"><div class="left-panel-left"><div class="btn" :class="{active:mode==='outline'}" @click="()=>toggleMode('outline')"><Lightning /></div><div class="btn" :class="{active:mode==='blocks'}" @click="()=>toggleMode('blocks')"><Share /></div></div><!-- 接入动画 --><transition name="app-left-panel-drawer"><div class="left-panel-content" v-show="mode">{{mode}}<!-- 面板中使用SmoothDnd --><SmoothDndContainer class="block-group" behaviour="copy"tag="div"  group-name="blocks" @drag-start="(e,v)=>console.log(e,v)" @drag-leave="(e,v)=>console.log(e,v)"@drop="(e)=>console.log('drop',e)":get-child-payload="(index:number)=>index"><SmoothDndDraggable v-for="i in 10" :key="i"><div class="block-item">{{i}}</div></SmoothDndDraggable></SmoothDndContainer></div></transition></div>
</template><style scoped>
.left-panel-wrapper {display: flex;height: 100%;background-color: #f5f5f5;border: 1px solid #e8e8e8;
}
.left-panel-left{display: flex;padding:0 10px;flex-direction: column;align-items: center;width: 50px;height: 100%;background-color: #e8e8e8;
}
.btn{width: 32px;height: 32px;display: flex;justify-content: center;align-items: center;cursor: pointer;border-radius: 6px;margin-top:20px;/* &:hover{background-color: #f5f5f5;} */
}
.btn:hover{background-color: #f5f5f5;
}
/* 被激活时候的特定样式 */
.btn.active{background-color: rgb(0,196,83);color: #fff;
}
.left-panel-content{flex: 1;width: 280px;height: 100%;background-color: #f5f5f5;overflow: hidden;
}/* 下面我们会解释这些 class 是做什么的 */
.app-left-panel-drawer-enter-active,
.app-left-panel-drawer-leave-active {transition: width 0.1s cubic-bezier(0.3, 0.1, 0.3, 1);
}.app-left-panel-drawer-enter-from,
.app-left-panel-drawer-leave-to {width: 0;
}.app-left-panel-drawer-content {width: calc(var(--panel-width) - 60px);height: 100%;padding: 16px;
}.block-item{width: 40px;height: 40px;background-color: #fff;border: 1px solid #e8e8e8;margin-bottom: 8px;display: flex;justify-content: center;align-items: center;font-size: 14px;transition:background-color 0.3s;cursor: move;user-select: none;
}.block-group{padding: 8px;display: flex;flex-wrap: wrap;gap: 8px;
}
</style>

LayoutView.vue

  <SmoothDndContainer class="block-group" orientation="vertical"tag="div"  group-name="blocks" @drop="(payload)=>editorStore.addBlock(payload)"  ><SmoothDndDraggable v-for="block in blocks" :key="block"
http://www.lryc.cn/news/382019.html

相关文章:

  • 【Linux进程】Linux下的---七大进程状态(什么是进程状态?Linux下有哪些进程状态?)
  • Linux的dev/ 和 sys/ 和 proc/ 目录
  • 代码随想录算法训练营day64 | 98. 所有可达路径
  • php上传zip压缩包到服务器并解压,解析压缩包内excel表格数据导入到数据库
  • 48-5 内网渗透 - JuicyPotato、Pipe Potato提权
  • Windows C++ 应用软件开发从入门到精通详解
  • Leetcode 3195. Find the Minimum Area to Cover All Ones I
  • ONLYOFFICE8.1版本桌面编辑器测评
  • 线性代数|机器学习-P15矩阵A的低秩变换下的逆矩阵
  • 强强联合 极光推送(JPush)成为华为生态市场首家推送类SDK服务商
  • 防止在 Qt 中触发信号
  • 【UML用户指南】-17-对基本行为建模-交互
  • Java中的类加载器与热部署技术详解
  • 【事件总线】EventBus
  • LeetCode 热题100 --双指针
  • 从《深入设计模式》一书中学到的编程智慧
  • Redis 基本配置
  • 【C++庖丁解牛】函数栈帧的创建与销毁
  • Java基础16(集合框架 List ArrayList容器类 ArrayList底层源码解析及扩容机制)
  • 数组:移除元素
  • 胡说八道(24.6.22)——通信杂谈(完结)
  • 设计模式原则——里氏替换原则
  • 详解 ClickHouse 的 SQL 操作
  • WPF与Winform,你的选择是?
  • 基于SpringBoot的实习管理系统设计与实现
  • 编程用什么电脑不卡的:深度解析与推荐
  • 优先级队列模拟实现
  • 记一次服务器崩溃事件
  • 神经网络 #数据挖掘 #Python
  • 营销复盘秘籍,6步法让你的活动效果翻倍