Drag and drop VUE components

Recently, I am optimizing a Vue blog system and want to implement the article dragging function at the article list. I tried the awe-dnd vue plug-in and found it to be quite easy to use.

Install

npm install awe-dnd --save

Use

In main.js, Import through Vue.use

import VueDND from 'awe-dnd' Vue.use(VueDND) 

Use in vue files

 <template> <div class="color-list"> <div class="color-item" v-for="color in colors "v-dragging="{ item: color, list: colors, group:'color', otherData: otherData }" :key="color.text" >{{color.text}}div> div> template> <script> export default {data () {return {colors: [{ text: "Aquamarine" }, {text: "Hotpink" }, {text: < span class="hljs-string">"Gold" }, {text: "Crimson" }, {text: "Blueviolet" }, {text: "Lightblue" }, {< span class="hljs-attr">text: "Cornflowerblue" }, {text: " Skyblue" }, {text: "Burlywood" }]} }, mounted () {this.$dragging.$on('dragged', ({ value }) => {console.log(value.item) console.log(value.list) console.log(value.otherData) }) this.$dragging.$on('dragend', () => {})}} script> < /span>< /span>

Component parameters

Component parameters h4>

Name Type Default value Description
ite m Object Every draggable object
list Array Array of draggable objects
group String

This is a unique key of a dragging list

After dragging is completed, you need to The new array order is submitted to the background, and a sort_order field is created to save the order.

Reference: Draggable sorting vue component, github

Author: real_ting Link: https://www.jianshu.com/p/7afcf8a7af75 Source: The copyright of the short book belongs to the author. For any form of reprint, please contact the author for authorization and indicate the source.

Recently, I am optimizing a vue blog system and want to implement the article dragging function at the article list. I tried the awe-dnd vue plug-in and found it to be quite easy to use.

Install

npm install awe-dnd --save

Use

In main.js, Import through Vue.use

import VueDND from 'awe-dnd' Vue.use(VueDND) 

Use in vue files

 <template> <div class="color-list"> <div class="color-item" v-for="color in colors "v-dragging="{ item: color, list: colors, group:'color', otherData: otherData }" :key="color.text" >{{color.text}}div> div> template> <script> export default { data () {return {colors: [{ text: "Aquamarine" }, {text: "Hotpink" }, {text: "Gold" }, {text: "Crimson" }, {text: "Blueviolet" }, {text: "Lightblue" }, {text: "Cornflowerblue" }, {text: "Skyblue "}, {text: "Burlywood" }]} }, mounted () {this.$dragging.$on('dragged', ({ value }) => {console.log(value.item) console.log(value.list) console.log(value.otherData) }) < span class="hljs-keyword">this.$dragging.$on('dragend', () => {})}}  script>   span>  span>

Component parameters

Name Type Default value Description
item Objec t Every draggable object
list Array Array of draggable objects
group String

This is a unique key of a dragging list

After dragging is completed, the new array sequence needs to be submitted to the background. Create a sort_order field to save the order.

Reference: Draggable sorting vue component, github

Author: real_ting Link: https://www.jianshu.com/p/7afcf8a7af75 Source: The copyright of the short book belongs to the author. For any form of reprint, please contact the author for authorization and indicate the source.

Recently, I am optimizing a vue blog system, and I want to implement the article dragging function at the article list. I tried the awe-dnd vue plug-in and found it to be quite easy to use.

Install

npm install awe-dnd --save

Use

In main.js, Import through Vue.use

import VueDND from 'awe-dnd' Vue.use(VueDND) 

Use in vue files

 <template> <div class="color-list"> <div class="color-item" v-for="color in colors "v-dragging="{ item: color, list: colors, group:'color', otherData: otherData }" :key="color.text" >{{color.text}}div> div> template> <script> export default {data () {return {colors: [{ text: " Aquamarine" }, {text: "Hotpink" }, {text: "Gold" }, {text: "Crimson" }, {text : "Blueviolet" }, {text: "Lightblue" }, {text: "Cornflowerblue" }, {text: "Skyblue" }, {text: "Burlywood" }]} }, mounted () {< span class="hljs-keyword">this.$dragging.$on('dragged', ({ value }) => {console .log(value.item) console.log(value.list) console.log(value.otherData) }) this.$dragging.$on('dragend', () => {})}} script>   span>  span>

Component parameters

Name Type Default value Description
item Object Every draggable object
list Array draggable Array of dragging objects
group String This is a unique key of a dragging list

After dragging is completed, you need to submit the new array sequence to the background and create a sort_order field to save the sequence.

Reference: Draggable sorting vue component, github

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3994 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.