您好,登錄后才能下訂單哦!
這篇文章主要介紹了vuedraggable怎么實(shí)現(xiàn)拖拽功能的相關(guān)知識(shí),內(nèi)容詳細(xì)易懂,操作簡(jiǎn)單快捷,具有一定借鑒價(jià)值,相信大家閱讀完這篇vuedraggable怎么實(shí)現(xiàn)拖拽功能文章都會(huì)有所收獲,下面我們一起來(lái)看看吧。
npm i -S vuedraggable
<template> <div> <a-checkbox-group @change="onChange"> <draggable group="people" class="list-group" ghost-class="ghost" :move="checkMove"> <!-- :list="myArray" :disabled="!enabled" @start="drag=true" @end="drag=false" --> <div class="list-group-item" v-for="(item,index) in myArray" :key="item.index"> <a-checkbox :value="item.value"> {{item.name}} </a-checkbox> </div> </draggable> </a-checkbox-group> </div> </template> <script> //引入vuedraggable import draggable from 'vuedraggable' export default { components : { draggable}, data () { return { enabled: true, myArray : [{ name:'臨汾', value:1 },{ name:'運(yùn)城', value:2 },{ name:'長(zhǎng)治', value:3 },{ name:'晉城', value:4 }], } }, methods: { onChange(checkedValues) { console.log(checkedValues); //復(fù)選框選中的值 }, checkMove(){ console.log(this.myArray) //實(shí)時(shí)myarray數(shù)據(jù),每拖動(dòng)一次就會(huì)得到最新的排列數(shù)據(jù) }, } } </script> <style scoped> .flip-list-move { -webkit-transition: -webkit-transform 0.5s; transition: -webkit-transform 0.5s; transition: transform 0.5s; transition: transform 0.5s, -webkit-transform 0.5s; } .no-move { -webkit-transition: -webkit-transform 0s; transition: -webkit-transform 0s; transition: transform 0s; transition: transform 0s, -webkit-transform 0s; } .ghost { opacity: 0.5; background: #c8ebfb; } .list-group { min-height: 20px; } .list-group-item { cursor: move; } .list-group-item i { cursor: pointer; } .list-group-item:first-child { border-top-left-radius: 4px; border-top-right-radius: 4px; } .list-group-item { position: relative; display: block; padding: 10px 105px; margin-bottom: -1px; background-color: #fff; border: 1px solid #ddd; } .list-group-item:last-child { margin-bottom: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } </style>
關(guān)于“vuedraggable怎么實(shí)現(xiàn)拖拽功能”這篇文章的內(nèi)容就介紹到這里,感謝各位的閱讀!相信大家對(duì)“vuedraggable怎么實(shí)現(xiàn)拖拽功能”知識(shí)都有一定的了解,大家如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。