awe-dnd
下载:npm install awe-dnd --save
全局引入:
import VueDND from 'awe-dnd'
Vue.use(VueDND)
模板使用
<div class="color-list">
<div
class="color-item"
v-for="color in colors" v-dragging="{ item: color, list: colors, group: 'color', otherData: otherData, comb: 'isComb' }"
:key="color.text"
>{{color.text}}</div>
</div>
监听拖拽事件:
export default {
mounted () {
this.on('dragged', ({ value }) => {
console.log(value.item)
console.log(value.list)
console.log(value.otherData)
})
this.on('dragend', () => {
})
}
}
网友评论