admin-fe/src/views/components-demo/dndList.vue

40 lines
835 B
Vue
Raw Normal View History

2017-04-18 13:38:49 +00:00
<template>
<div class="components-container">
2017-11-22 03:01:19 +00:00
<code>drag-list base on
<a href="https://github.com/SortableJS/Vue.Draggable" target="_blank">Vue.Draggable</a>
</code>
2017-04-18 13:38:49 +00:00
<div class="editor-container">
<dnd-list :list1="list1" :list2="list2" list1-title="List" list2-title="Article pool"/>
2017-04-18 13:38:49 +00:00
</div>
</div>
</template>
2017-07-06 09:56:17 +00:00
2017-04-18 13:38:49 +00:00
<script>
2017-10-24 09:37:14 +00:00
import DndList from '@/components/DndList'
2017-08-28 05:12:44 +00:00
import { fetchList } from '@/api/article'
2017-07-06 09:56:17 +00:00
2017-08-22 07:43:34 +00:00
export default {
name: 'DndListDemo',
2017-08-22 07:43:34 +00:00
components: { DndList },
data() {
return {
list1: [],
list2: []
2017-07-06 09:56:17 +00:00
}
2017-08-22 07:43:34 +00:00
},
created() {
2017-08-28 05:12:44 +00:00
this.getData()
2017-08-22 07:43:34 +00:00
},
methods: {
2017-08-28 05:12:44 +00:00
getData() {
2017-08-22 07:43:34 +00:00
this.listLoading = true
2017-08-28 05:12:44 +00:00
fetchList().then(response => {
this.list1 = response.data.items.splice(0, 5)
this.list2 = response.data.items
2017-08-22 07:43:34 +00:00
})
}
}
}
2017-04-18 13:38:49 +00:00
</script>