侧边栏高亮问题: 侧边栏不能跟着自己的路由高亮,element-ui官方已经给了default-active所以我们只要 将default-active
一直指向当前路由就可以了
:default-active="$route.path"
table表格几个常用的功能。
Table 拖拽排序 基于Sortable
https://github.com/SortableJS/Sortable
import Sortable from 'sortablejs'
let el = document.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
let sortable = Sortable.create(el)
在table mounted之后申明Sortable.create(el)
table的每行tr就可以随意拖拽了,麻烦的目前我们的排序都是基于dom的,我们的数据层list并没有随之改变。所以我们就要手动的来管理我们的列表。
this.sortable = Sortable.create(el, {
onEnd: evt => { //监听end事件 手动维护列表
const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]