element 的table在使用sortablejs实现拖动排序的时候,禁止拖动到某行怎么做

image.png
列表的第一个是不允许修改的,所以排序的时候不能让下面的拖到第一个来,怎么做呢?

阅读 8.1k
1 个回答
onEnd(e){
 if(e.newIndex==0){
    const currentRow=list.splice(e.oldIndex,1);//拿到当前拖拽行
    this.list.splice(1,0,currentRow);//拖拽到第一行的默认放到第二行
    const list=JSON.parse(JSON.stringgify(this.list));
    this.$nextTick(()=>{
      this.list=list;
    })
 }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题