<template>
<div class="wrapper wrapper-content" id="main" v-cloak>
<div class="row">
<!-- top -->
<div class="col-sm-12 animated fadeInRight">
<div class="btn-sm btn btn-white navBackground">
<p class="pull-left" id="iconBackground">
<i class="fa fa-cog"></i>工作看板</p>
<img class="pull-left" src="../../../static/img/navbar.png" />
<p class="pull-left">我的看板</p>
</div>
<div class="clearfix"></div>
<div v-for="(listItem,index) in dataList" class="col-md-3 cardList">
<h3>{{listItem.listName}}<span @click="editListName(listItem,index)"></span></h3>
<draggable class="dragArea" :list="listItem.list" :options="{group:'people'}" @change="log">
<div v-for="(element, index) in listItem.list" :key="index" class="lineData">
{{element.name}} {{index}}
</div>
<div :key="listItem.list.length" style="opacity: 0;height: 8px">test1</div>
</draggable>
<div @click="addNewCardShow(listItem)" v-show="listItem.listAdd" class="addNewCardShow"><a href="javascript:void(0)" class="hoverStyle">添加卡片...</a></div>
<div class="hideAddItem" v-show="!listItem.listAdd">
<textarea style="width:100%" v-model="itemValue"></textarea>
<p><button class="btn zbtn-bg btn-sm" @click="addNewCard(listItem)">添加</button><a href="javascript:void(0)" class="hoverStyle" @click="closeAddItem(listItem)">X</a></p>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import draggable from 'vuedraggable'
import Sortable from 'vue-sortable'
export default {
name: "app",
data(){
return{
itemAddShow:true,
itemValue:'',
dataList:[
{list:[{name:"John", id:1},
{name:"Joao", id:2},
{name:"Jean", id:3},
{name:"Gerard", id:4} ],
listName:'待办事项',
listAdd:true},
{list:[{name:"Juan", id:5},
{name:"Edgard", id:6},
{name:"Johnson", id:7} ],
listName:'延期事项',
listAdd:true},
{list:[{name:"tom", id:8},
{name:"mike", id:9},
{name:"lucy", id:10} ],
listName:'正常推进事项',
listAdd:true},
{list:[{name:"tomchen", id:8},
{name:"mikechen", id:9},
{name:"lucychen", id:10} ],
listName:'已完结事项',
listAdd:true}

]
}
},
components:{
'draggable':draggable
},
methods:{
editListName(){

},
addNewCardShow(listItem){
listItem.listAdd=false;
},
addNewCard(listItem){
if(this.itemValue==''){
return false;
}
let itemV=this.itemValue;
let tempTime=new Date().getTime();
let itemValue={name:itemV, id:tempTime};
console.log(itemValue);
listItem.list.push(itemValue);
this.itemValue='';
},
closeAddItem(listItem){
listItem.listAdd=true;
},
log: function (evt){
console.log(evt)
}
},
mounted(){

}
}
</script>
<style>
.addNewCardShow{
height: 24px;
line-height: 24px;
}
.cardList{
border:1px solid #ccc;
padding: 0 4px;
/*margin-right: 10px;*/
background: #eceaea;
border-radius: 6px;
}
.cardList>h3{
background: #eceaea;
margin: 0;
height: 36px;
line-height: 36px;
padding: 0 8px;
}
body{
font-family:'微软雅黑'
}
[v-cloak]{
display:none;
}
#example{
/*width:1000px;*/
margin:0 auto;
}
.list-complete-item {
transition: all 1s;
/*height:50px;*/
line-height: 50px;
background: #ccc;
color:#fff;
text-align: center;
font-size:24px;
margin-top:10px;
border-right: 1px solid #ccc;
}
.styleclass{
width:100px;
float:left;
}
.list-complete-enter, .list-complete-leave-active {
opacity: 0;
height: 0px;
margin-top: 0px;
padding: 0px;
border: solid 0px;
}
.list-complete-sortable-chosen,.list-complete-sortable-ghost{
opacity: 0;
height: 0px;
margin-top: 0px;
padding: 0px;
border: solid 0px;
}
.dargDiv{
cursor:move;
background:#78BC27;
}
.wrods{
margin-top:50px;
}
p{
line-height:24px;
}
.lineData{
background:white;
cursor: move;
padding: 4px 8px;
border: 1px solid #ccc;
}
</style>

卡片拖拽(vue拖拽事件)的更多相关文章

  1. vue 拖拽移动(类似于iPhone虚拟home )

    vue 移动端 PC 兼容 元素 拖拽移动  效果演示 事件知识点 移动端 PC端 注释 touchstart mousedown 鼠标/手指按下事件 touchmove mousemove 鼠标/手 ...

  2. Vue拖拽组件

    vue开发公众号项目,***产品需要添加一个新的功能.拖拽功能.一听简单.百度上轮子挺多,直接拉一个过来用着就行.然鹅...兴奋之余,却失望至极.东西很多,没有一个能使得.你让我失望,那我就让你绝望. ...

  3. vue拖拽组件开发

    vue拖拽组件开发 创建临时vue项目 先查看node和npm版本,怎么安装就不多多bb了 再安装vue-cli npm install vue-cli -g //全局安装 vue-cli 检测是否安 ...

  4. 前端vue拖拽

    工作上遇到的需求:页面上需要拖拽一个小方块div拷贝至保存的容器中. 一.可拖拽 那么我们需要对小方块div进行授权,设置draggable="true"允许其被拖动 二.定义拖拽 ...

  5. c# 实现文件拖入和拖出(拖拽)

    摘自:http://www.cnblogs.com/eaglet/archive/2009/01/06/1370149.html C# WinForm下一步一步实现文件的拖入和拖出 作者:Eaglet ...

  6. vue for 绑定事件

    vue for 绑定事件 <div id="pro_list" v-for="item in pro_list"> <div class=&q ...

  7. Vue方法与事件

    gitHub地址:https://github.com/lily1010/vue_learn/tree/master/lesson10 一 vue方法实现 <!DOCTYPE html> ...

  8. React对比Vue(03 事件的对比,传递参数对比,事件对象,ref获取DOM节点,表单事件,键盘事件,约束非约束组件等)

    import React from 'react'; class Baby extends React.Component { constructor (props) { super(props) t ...

  9. Vue中的事件与常见的问题处理

    Vue的事件:获取事件对象$event: 事件冒泡:事件会向上传播 原生js阻止事件冒泡,需要先获取事件对象,再调用stopPropagation()方法: vue事件修饰符stop,例@clik.s ...

  10. vue教程1-05 事件 简写、事件对象、冒泡、默认行为、键盘事件

    vue教程1-05 事件 简写.事件对象.冒泡.默认行为.键盘事件 v-on:click/mouseover...... 简写的: @click="" 推荐 事件对象: @clic ...

随机推荐

  1. error: atomic: 没有那个文件或目录

    Linux下编译的时候遇到一个问题,就是提示    error: atomic: 没有那个文件或目录 执行的命令是gcc -o myCXXLog myCXXLog.c 经过网上搜索,解决方法有二 (1 ...

  2. 小D课堂 - 新版本微服务springcloud+Docker教程_6-05 高级篇幅之高并发情况下

    笔记 5.高级篇幅之高并发情况下接口限流特技         简介:谷歌guava框架介绍,网关限流使用 1.nginx层限流 2.网关层限流 开始 mysql最大的连接数就是3千多.如果想把应用搞好 ...

  3. vue导航菜单调用PHP后台数据

    数据库设计: 后台PHP输出所有菜单数据(index.php): <?phpheader("Access-Control-Allow-Origin:*");header(&q ...

  4. java+web文件的上传和下载代码

    一般10M以下的文件上传通过设置Web.Config,再用VS自带的FileUpload控件就可以了,但是如果要上传100M甚至1G的文件就不能这样上传了.我这里分享一下我自己开发的一套大文件上传控件 ...

  5. hive端建表中文注释乱码

    背景:mysql编码是utf-8,mysql中建库建表中文显示都正常,但在hive窗口中建表时字段中文注释均乱码的问题. 问题:hive中建表后字段中文注释显示异常. 1. 定位 mysql 端问题 ...

  6. three.js 之 透明物体不能正常显示

    这几天遇到一个需求,类似这个案例:http://www.hightopo.com/demo/FaultDetection/ 就是这个透明渐变呼吸光柱,看到之后就想着写个shader材质实现透明度渐变, ...

  7. python录音并调用百度语音识别接口

    #!/usr/bin/env python import requests import json import base64 import pyaudio import wave import os ...

  8. VMware中centos虚拟机的安装

    几个月前,就下载了VMware,centOS 6 操作系统镜像.苦于对linux的不理解和安装教程的不熟悉,一直未安装成功. 几天前,终于独自安装好了,特此记录一下. 安装其实很简单,之前失败是在于安 ...

  9. poco编译与运行

    1.引言 Poco C++库是: 一系列C++类库,类似Java类库,.Net框架,Apple的Cocoa; 侧重于互联网时代的网络应用程序 使用高效的,现代的标准ANSI/ISO C++,并基于ST ...

  10. WijmoJS V2019.0 Update2发布:再度增强 React 和 Vue 框架的组件功能

    前端开发工具包 WijmoJS 在2019年的第二个主要版本 V2019.0 Update2 已经发布,本次发布涵盖了React 和 Vue 框架下 WijmoJS 前端组件的功能增强,并加入更为易用 ...