<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. docker网络(3)

    docker网络介绍 大量的互联网应用服务需要多个服务组件,这往往需要多个容器之间通过网络通信进行相互配合. docker 网络从覆盖范围可分为单个 host 上的容器网络和跨多个 host 的网络. ...

  2. Spring-Kafka —— 实现批量消费和手动提交offset

    spring-kafka的官方文档介绍,可以知道自1.1版本之后, @KafkaListener开始支持批量消费,只需要设置batchListener参数为true 把application.yml中 ...

  3. Java集合(7):散列与散列码

    散列的价值在于速度.我们使用数组来保存键的信息,这个信息并不是键本身,而是通过键对象生成一个数字(散列码),作为数组下标.由于数组的容量是固定的,而散列容器的大小是可变的,所以不同的键可以产生相同的数 ...

  4. hadoop第一个程序WordCount

    hadoop第一个程序WordCount package test; import org.apache.hadoop.mapreduce.Job; import java.io.IOExceptio ...

  5. Hyperledger Fabric1.4 网络环境搭建步骤

    1.  外部访问虚拟机: 安装ssh apt-get install openssh-server openssh-client 2.  安装vim sudo apt install vim 3.  ...

  6. jQuery代码书写规范

    1. 对于同一个对象不超过三个操作的,可以直接写成一行 $("li").show().unbind("click"); 2. 对于同一个对象的较多操作,建议每行 ...

  7. Summary of OAuth 2.0

    Summary of OAuth 2.0 1 Problems: This pattern of applications obtaining user passwords obviously has ...

  8. 截取铃声python代码

    from pydub import AudioSegment file_name = "张杰 - 这就是爱.mp3" sound = AudioSegment.from_mp3(f ...

  9. 关于MYSQL安装踩的坑

    前提:本人装的版本是mysql-8.0.18-winx64,win10系统,如果你安装的是其他版本的MYSQL,语法会跟下面有些许区别: 一,安装 https://dev.mysql.com/down ...

  10. hdoj1520(入门树形dp)

    题目链接:https://vjudge.net/problem/HDU-1520 题意:和luogu那道没有上司的舞会一样的题,给定一棵带点权的树,父结点和子结点不能同时选,问怎么选使得权值和最大,求 ...