vuedraggable实现组件拖拽设计网页修改属性示例代码

代码语言:html

所属分类:拖放

代码描述:vuedraggable实现组件拖拽设计网页修改属性示例代码,左侧可拖拽组件到设计区,还可修改属性,可基于此代码做出更加复杂的手机端网页设计。

代码标签: vue draggable 组件 拖拽 设计 网页 修改 属性 示例 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue Draggable Design Tool</title>

   <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1.js"></script>
   <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/Sortable-1-8-4.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vuedraggable.umd.2.20.0.js"></script>
  <style>
  body{
      background: white;
  }
    #app {
      display: flex;
      justify-content: space-between;
    }
    .panel {
      border: 1px solid black;
      margin: 10px;
      padding: 10px;
      flex-basis: 30%;
    }
    .component {
      border: 1px solid #ccc;
      margin-bottom: 4px;
      padding: 6px;
      cursor: pointer;
      background-color: #f9f9f9;
    }
    .component.dragging {
      opacity: 0.5;
    }
    .design-area {
      border: 1px dashed #aaa;
      min-height: 300px;
      flex-grow: 1;
      margin: 10px;
      padding: 10px;
    }
    .properties-area {
      flex-basis: 20%;
    }
  </style>
</head>
<body>
<div id="app">
  <div class="panel component-library">
    <h4>组件库</h4>
    <draggable   class="drag-area" :list="components" :group="{name: 'components',pull: 'clone',put: false}"  :sort="false" :clone="cloneComponent">
      <div class="component" v-for="component in components" :key="component.type" >
        {{ component.label }}
      </div>
    </draggable>
  </div>
  
  <div class="design-area">
    <h4>设计区</h4>
    <draggable is="draggable" class=&qu.........完整代码请登录后点击上方下载按钮下载查看

网友评论0