<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. PHP格式化数字和SMARTY格式化数字的方法

    PHP格式化: $num="3";$format="%06d";  //6是位数,这里有6位数,0是不足6位的补0$a=sprintf($format,$num ...

  2. [ML] Load and preview large scale data

    Ref: [Feature] Preprocessing tutorial 主要是 “无量纲化” 之前的部分. 加载数据 一.大数据源 http://archive.ics.uci.edu/ml/ht ...

  3. CMDB项目

    实现功能 邮箱验证码注册 图片验证码登陆 生成验证码图片,前端请求图片: 获取验证码字符串,防入当前session: 获取前端用户名.密码.验证码: 判断验证码是否匹配,判断用户名和密码是否匹配. 设 ...

  4. MySQL数据库同步工具的设计与实现

    一.背景 在测试过程中,对于不同的测试团队,出于不同的测试目的,我们可能会有多套测试环境.在产品版本迭代过程中,根据业务需求,会对数据库的结构进行一些修改,如:新增表.字段.索引,修改表.字段索引等操 ...

  5. Linux服务器端使用tcpdump抓redis报文

    yum update yum install tcpdump tcpdump host -i ens192 -w /tmp/redis-zsetcapture.cap 其中ens192是网卡名, /t ...

  6. 【Linux】配置SSH免密登录

    环境说明 假设我们有三台机器分别为bigdata111,bigdata112,bigdata113,三台机器均为centos 7系统. 配置SSH免密登录 (1)利用Xshell的发送键输入到所有会话 ...

  7. sqlalchemy 的操作

    使用PyMySQL的前提: 1. 先建好表 2. 自己动手需要手动去写多条SQL语句 改进: 类 ------>  表 实例化 -> 数据 这种思想叫:ORM(Object Relatio ...

  8. Spring Cloud health节点通过注册中心扫描状态的简单实现

    package com.zjs.web; import com.netflix.appinfo.InstanceInfo; import com.zjs.FallbackApiApplication; ...

  9. 阿里云服务器安装svn完整步骤,避免新手可能出现的所有错误

    centos6.8,没有安装svn的情况: 1.安装: yum install subversion (这一步一般不会错) 2.创建svn版本库: cd /root mkdir -p svn/proj ...

  10. 浅析C语言中printf(),sprintf(),scanf(),sscanf()的用法和区别

    printf语法: #include <stdio.h>int printf( const char *format, ... ); printf()函数根据format(格式)给出的格式 ...