一开始直接使用的document去获取一直报错
rowDrop () {
const el = document.querySelector(".el-table__body-wrapper tbody");
new Sortable(el)
}
后面通过在el-table 加上ref后在进行获取dom后就解决了问题
<el-table
ref="table"
size="small"
:data="tableData"
border
align="left"
>
...
<el-table/>
rowDrop () {
const el =(this.$refs.table as any).$el.querySelector(".el-table__body-wrapper tbody");
new Sortable(el)
}