-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add draggable kanban using vue-draggable (#625)
- Loading branch information
1 parent
8f37950
commit 543a992
Showing
6 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<template> | ||
<div class="board-column"> | ||
<div class="board-column-header"> | ||
{{headerText}} | ||
</div> | ||
<draggable | ||
class="board-column-content" | ||
:list="list" | ||
:options="options"> | ||
<div class="board-item" v-for="element in list" :key="element.id"> | ||
{{element.name}} {{element.id}} | ||
</div> | ||
</draggable> | ||
</div> | ||
</template> | ||
<script> | ||
import draggable from 'vuedraggable' | ||
export default { | ||
name: 'dragKanban-demo', | ||
components: { | ||
draggable | ||
}, | ||
props: { | ||
headerText: { | ||
type: String, | ||
default: 'Header' | ||
}, | ||
options: { | ||
type: Object, | ||
default() { | ||
return {} | ||
} | ||
}, | ||
list: { | ||
type: Array, | ||
default() { | ||
return [] | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
<style lang="scss"> | ||
.board-column { | ||
min-width: 300px; | ||
min-height: 100px; | ||
height: auto; | ||
overflow: hidden; | ||
background: #f0f0f0; | ||
border-radius: 3px; | ||
.board-column-header { | ||
height: 50px; | ||
line-height: 50px; | ||
overflow: hidden; | ||
padding: 0 20px; | ||
text-align: center; | ||
background: #333; | ||
color: #fff; | ||
border-radius: 3px 3px 0 0; | ||
} | ||
.board-column-content { | ||
height: auto; | ||
overflow: hidden; | ||
border: 10px solid transparent; | ||
min-height: 60px; | ||
display: flex; | ||
justify-content: flex-start; | ||
flex-direction: column; | ||
align-items: center; | ||
.board-item { | ||
cursor: pointer; | ||
width: 100%; | ||
height: 64px; | ||
margin: 5px 0; | ||
background-color: #fff; | ||
text-align: left; | ||
line-height: 54px; | ||
padding: 5px 10px; | ||
box-sizing: border-box; | ||
box-shadow: 0px 1px 3px 0 rgba(0,0,0,0.2); | ||
} | ||
} | ||
} | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<template> | ||
<div class="components-container board"> | ||
<Kanban :key="1" class="kanban todo" :list="list1" :options="options" header-text="Todo"/> | ||
<Kanban :key="2" class="kanban working" :list="list2" :options="options" header-text="Working"/> | ||
<Kanban :key="3" class="kanban done" :list="list3" :options="options" header-text="Done"/> | ||
</div> | ||
</template> | ||
<script> | ||
import Kanban from '@/components/Kanban' | ||
export default { | ||
name: 'dragKanban-demo', | ||
components: { | ||
Kanban | ||
}, | ||
data() { | ||
return { | ||
options: { | ||
group: 'mission' | ||
}, | ||
list1: [ | ||
{ name: 'Mission', id: 1 }, | ||
{ name: 'Mission', id: 2 }, | ||
{ name: 'Mission', id: 3 }, | ||
{ name: 'Mission', id: 4 } | ||
], | ||
list2: [ | ||
{ name: 'Mission', id: 5 }, | ||
{ name: 'Mission', id: 6 }, | ||
{ name: 'Mission', id: 7 } | ||
], | ||
list3: [ | ||
{ name: 'Mission', id: 8 }, | ||
{ name: 'Mission', id: 9 }, | ||
{ name: 'Mission', id: 10 } | ||
] | ||
} | ||
} | ||
} | ||
</script> | ||
<style lang="scss"> | ||
.board { | ||
width: 1000px; | ||
margin-left: 20px; | ||
display: flex; | ||
justify-content: space-around; | ||
flex-direction: row; | ||
align-items: flex-start; | ||
} | ||
.kanban { | ||
&.todo { | ||
.board-column-header { | ||
background: #4A9FF9; | ||
} | ||
} | ||
&.working { | ||
.board-column-header { | ||
background: #f9944a; | ||
} | ||
} | ||
&.done { | ||
.board-column-header { | ||
background: #2ac06d; | ||
} | ||
} | ||
} | ||
</style> | ||
|