怎么在vue中使用draggable实现拖拽移动图片顺序
怎么在vue中使用draggable实现拖拽移动图片顺序?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

站在用户的角度思考问题,与客户深入沟通,找到延川网站设计与延川网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站设计、成都做网站、企业官网、英文网站、手机端网站、网站推广、国际域名空间、网络空间、企业邮箱。业务覆盖延川地区。
首先,
npm i vuedraggable
然后在组件中引入,
import draggable from 'vuedraggable';
定义组件,
components: {
draggable,
},标签中应用,
-
{{ child.goodsName }}
低至¥{{ child.lowestPrice }}
{{ child.goodsName }}{{ child.browseNum }}
{{ child.thumbNum }}
方法,
getdata (data) {
},
datadragEnd (evt) {
var oneId = "";
var otherId = "";
// console.log('datadragEnd方法');
console.log('拖动前的索引 :' + evt.oldIndex)
console.log('拖动后的索引 :' + evt.newIndex)
if(evt.newIndex == this.hotVOList.length - 1 && this.pageData.pageNum < Math.ceil(this.pageData.total/10)){
this.$api.get("/mallConfig/hot_goods_list/" + this.addHotMallID,{
pageNum:this.pageData.pageNum+1,
pageSize:this.pageData.pageSize
},
su => {
if (su.httpCode == 200) {
this.newHotVOList = su.data.hotVOList;
oneId = su.data.hotVOList[0].decorateId;
otherId = this.hotVOList[evt.newIndex].decorateId;
this.$api.get(
"/mallConfig/hot_product/exchage_turn/" + this.addHotMallID,
{
oneId: oneId,
otherId :otherId,
},
su => {
if (su.httpCode == 200) {
this.getBodyList(this.addHotMallID);
}
},
err => {},
{ accessToken: sessionStorage.getItem("accessToken") }
);
}
},
err => {},
{ accessToken: sessionStorage.getItem("accessToken") })
} else if(evt.newIndex == this.hotVOList.length - 1 && this.pageData.pageNum == Math.ceil(this.pageData.total/10)){
otherId = this.hotVOList[evt.newIndex].decorateId;
oneId = -1;
this.$api.get(
"/mallConfig/hot_product/exchage_turn/" + this.addHotMallID,
{
oneId: oneId,
otherId :otherId,
},
su => {
if (su.httpCode == 200) {
this.getBodyList(this.addHotMallID);
}
},
err => {},
{ accessToken: sessionStorage.getItem("accessToken") }
);
} else {
otherId = this.hotVOList[evt.newIndex].decorateId;
oneId = this.hotVOList[evt.newIndex + 1].decorateId;
this.$api.get(
"/mallConfig/hot_product/exchage_turn/" + this.addHotMallID,
{
oneId: oneId,
otherId :otherId,
},
su => {
if (su.httpCode == 200) {
this.getBodyList(this.addHotMallID);
}
},
err => {},
{ accessToken: sessionStorage.getItem("accessToken") }
);
}
},关于怎么在vue中使用draggable实现拖拽移动图片顺序问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。
分享名称:怎么在vue中使用draggable实现拖拽移动图片顺序
网页网址:http://lzwzjz.cn/article/igophd.html


咨询
建站咨询
