问题描述
我正在使用来自 SortableJS 的 Swap 函数 当与最后一个元素交换元素时,下一个添加的项目被添加在最后一个项目之前而不是最后一个项目之后,有人知道为什么会这样吗?但是当我将最后一个项目与其他项目交换时它工作正常,这是怎么回事?
演示:https://fir-778e1.web.app/ 代码:
setup() {
const clueDiv = ref(null)
const points = ref({ pointList: [1,2,3,4,5]})
function addPoint() {
let last = points.value.pointList[points.value.pointList.length - 1]
points.value.pointList.push(last + 1)
}
onMounted(() => {
Sortable.create(clueDiv.value,{
swap: true,});
})
return { clueDiv,points,addPoint }
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)