Blame view

src/views/components-demo/dnd-list.vue 838 Bytes
d7d9c38c2   Adam   auto commit the c...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  <template>
    <div class="components-container">
      <aside>drag-list base on
        <a href="https://github.com/SortableJS/Vue.Draggable" target="_blank">Vue.Draggable</a>
      </aside>
      <div class="editor-container">
        <dnd-list :list1="list1" :list2="list2" list1-title="List" list2-title="Article pool" />
      </div>
    </div>
  </template>
  
  <script>
  import DndList from '@/components/DndList'
  import { fetchList } from '@/api/article'
  
  export default {
    name: 'DndListDemo',
    components: { DndList },
    data() {
      return {
        list1: [],
        list2: []
      }
    },
    created() {
      this.getData()
    },
    methods: {
      getData() {
        this.listLoading = true
        fetchList().then(response => {
          this.list1 = response.data.items.splice(0, 5)
          this.list2 = response.data.items
        })
      }
    }
  }
  </script>