作者 小范

新增tab组件拖动功能

@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 31
32 <script> 32 <script>
33 import Assembly from "@/views/bus/Assembly"; 33 import Assembly from "@/views/bus/Assembly";
  34 + import Sortable from "sortablejs"
34 35
35 export default { 36 export default {
36 name: 'TabMenu', 37 name: 'TabMenu',
@@ -83,9 +84,27 @@ @@ -83,9 +84,27 @@
83 84
84 } 85 }
85 }, 86 },
  87 + // changeView(val){
  88 + // if(val == 'table') {this.rowDrop()}
  89 + // this.initTab()
  90 + // },
  91 + rowDrop() {
  92 + const el= document.querySelector('.el-tabs__nav');
  93 + const _this = this;
  94 + Sortable.create(el, {
  95 + onEnd({ newIndex, oldIndex }) {
  96 + const currRow = _this.$store.state.openTab.splice(oldIndex, 1)[0]
  97 + _this.$store.state.openTab.splice(newIndex, 0, currRow)
  98 + }
  99 + })
  100 + },
86 }, 101 },
87 mounted() { 102 mounted() {
88 this.initTab(); 103 this.initTab();
  104 + this.$nextTick(function () {
  105 + this.rowDrop(); //行拖拽效果
  106 + })
  107 +
89 }, 108 },
90 watch:{ 109 watch:{
91 '$route'(to,from){ 110 '$route'(to,from){
1 { 1 {
2 - "nmmsVer": "1.14" 2 + "nmmsVer": "1.15"
3 } 3 }