Vue component summary (1, drag and drop component Vue-draggable)

1. The vue-draggable installation uses the npm address:

            https://www.npmjs.com/package/vuedraggable

2. Use of form drag and drop, for example:

    <table class="table table-condensed">
         <thead>
                <tr>
                        <th>视频ID</th>
                        <th>名称</th>
                        <th>作者</th>
                        <th>创建时间</th>
                        <th>时长</th>
                        <th>操作</th>
                </tr>
            </thead>
            <draggable element="tbody" class="list-group" v-model="tableData">
                    <tr style="cursor:move;" v-for="(item,index) in tableData" :key="'item'+index">
                            <td>{{item.videoId}}</td>
                            <td>{{item.name}}</td>
                            <td>{{item.author.name}}</td>
                            <td>{{item.createTime}}</td>
                            <td>{{item.length}}</td>
                            <td>删除</td>
                    </tr>
            </draggable>
    </table>

    <script>
                import draggable from 'vuedraggable'
                export default {
                        components: { draggable },
                        data() {
                                return {
                                    tableData: {}
                                }
                        }
                }
    </script>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325984736&siteId=291194637