码迷,mamicode.com
首页 > 其他好文 > 详细

Vue 组件总结 (一、拖拽组件 Vue-draggable)

时间:2018-05-09 12:17:35      阅读:1778      评论:0      收藏:0      [点我收藏+]

标签:Vue-draggable   vue   

一、vue-draggable 安装使用npm地址:

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

二、表格拖拽使用, 举例:

    <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>

Vue 组件总结 (一、拖拽组件 Vue-draggable)

标签:Vue-draggable   vue   

原文地址:http://blog.51cto.com/13708381/2114317

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!