tab drag
This commit is contained in:
@@ -17,5 +17,6 @@ module.exports = [
|
|||||||
{ name: 'qs', library: 'Qs', js: 'https://cdn.jsdelivr.net/npm/qs@6.9.1/dist/qs.js', css: '' },
|
{ name: 'qs', library: 'Qs', js: 'https://cdn.jsdelivr.net/npm/qs@6.9.1/dist/qs.js', css: '' },
|
||||||
{ name: 'lowdb', library: 'low', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/low.min.js', css: '' },
|
{ name: 'lowdb', library: 'low', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/low.min.js', css: '' },
|
||||||
{ name: 'lowdb/adapters/LocalStorage', library: 'LocalStorage', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/LocalStorage.min.js', css: '' },
|
{ name: 'lowdb/adapters/LocalStorage', library: 'LocalStorage', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/LocalStorage.min.js', css: '' },
|
||||||
{ name: 'screenfull', library: 'screenfull', js: 'https://cdn.jsdelivr.net/npm/screenfull@5.0.0/dist/screenfull.min.js', css: '' }
|
{ name: 'screenfull', library: 'screenfull', js: 'https://cdn.jsdelivr.net/npm/screenfull@5.0.0/dist/screenfull.min.js', css: '' },
|
||||||
|
{ name: 'sortablejs', library: 'Sortable', js: 'https://cdn.jsdelivr.net/npm/sortablejs@1.10.1/Sortable.min.js', css: '' },
|
||||||
]
|
]
|
||||||
|
|||||||
5
package-lock.json
generated
5
package-lock.json
generated
@@ -14603,6 +14603,11 @@
|
|||||||
"is-plain-obj": "^1.0.0"
|
"is-plain-obj": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sortablejs": {
|
||||||
|
"version": "1.10.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.10.1.tgz",
|
||||||
|
"integrity": "sha512-N6r7GrVmO8RW1rn0cTdvK3JR0BcqecAJ0PmYMCL3ZuqTH3pY+9QyqkmJSkkLyyDvd+AJnwaxTP22Ybr/83V9hQ=="
|
||||||
|
},
|
||||||
"source-list-map": {
|
"source-list-map": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
"quill": "^1.3.6",
|
"quill": "^1.3.6",
|
||||||
"screenfull": "^5.0.0",
|
"screenfull": "^5.0.0",
|
||||||
"simplemde": "^1.11.2",
|
"simplemde": "^1.11.2",
|
||||||
|
"sortablejs": "^1.10.1",
|
||||||
"ua-parser-js": "^0.7.20",
|
"ua-parser-js": "^0.7.20",
|
||||||
"v-charts": "^1.19.0",
|
"v-charts": "^1.19.0",
|
||||||
"v-contextmenu": "^2.9.0",
|
"v-contextmenu": "^2.9.0",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
@rowClick="contextmenuClick"/>
|
@rowClick="contextmenuClick"/>
|
||||||
</d2-contextmenu>
|
</d2-contextmenu>
|
||||||
<el-tabs
|
<el-tabs
|
||||||
class="d2-multiple-page-control"
|
class="d2-multiple-page-control d2-multiple-page-sort"
|
||||||
:value="current"
|
:value="current"
|
||||||
type="card"
|
type="card"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapActions } from 'vuex'
|
import { mapState, mapActions } from 'vuex'
|
||||||
|
import Sortable from 'sortablejs'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
D2Contextmenu: () => import('../contextmenu'),
|
D2Contextmenu: () => import('../contextmenu'),
|
||||||
@@ -94,7 +95,8 @@ export default {
|
|||||||
'closeLeft',
|
'closeLeft',
|
||||||
'closeRight',
|
'closeRight',
|
||||||
'closeOther',
|
'closeOther',
|
||||||
'closeAll'
|
'closeAll',
|
||||||
|
'openedSort'
|
||||||
]),
|
]),
|
||||||
/**
|
/**
|
||||||
* @description 右键菜单功能点击
|
* @description 右键菜单功能点击
|
||||||
@@ -172,6 +174,15 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
const el = document.querySelectorAll('.d2-multiple-page-sort .el-tabs__nav')[0]
|
||||||
|
Sortable.create(el, {
|
||||||
|
onEnd: (evt) => {
|
||||||
|
const { oldIndex, newIndex } = evt
|
||||||
|
this.openedSort({ oldIndex, newIndex })
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -15,10 +15,10 @@
|
|||||||
}"
|
}"
|
||||||
flex-box="0"
|
flex-box="0"
|
||||||
flex>
|
flex>
|
||||||
<div class="logo-group" :style="{width: asideCollapse ? asideWidthCollapse : asideWidth}" flex-box="0">
|
<router-link to="/index" class="logo-group" :style="{width: asideCollapse ? asideWidthCollapse : asideWidth}" flex-box="0">
|
||||||
<img v-if="asideCollapse" :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/icon-only.png`">
|
<img v-if="asideCollapse" :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/icon-only.png`">
|
||||||
<img v-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`">
|
<img v-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`">
|
||||||
</div>
|
</router-link>
|
||||||
<div class="toggle-aside-btn" @click="handleToggleAside" flex-box="0">
|
<div class="toggle-aside-btn" @click="handleToggleAside" flex-box="0">
|
||||||
<d2-icon name="bars"/>
|
<d2-icon name="bars"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import routes from './routes'
|
|||||||
// fix vue-router NavigationDuplicated
|
// fix vue-router NavigationDuplicated
|
||||||
const VueRouterPush = VueRouter.prototype.push
|
const VueRouterPush = VueRouter.prototype.push
|
||||||
VueRouter.prototype.push = function push (location) {
|
VueRouter.prototype.push = function push (location) {
|
||||||
return VueRouterPush.call(this, location)
|
return VueRouterPush.call(this, location).catch(err => err)
|
||||||
}
|
}
|
||||||
const VueRouterReplace = VueRouter.prototype.replace
|
const VueRouterReplace = VueRouter.prototype.replace
|
||||||
VueRouter.prototype.replace = function replace (location) {
|
VueRouter.prototype.replace = function replace (location) {
|
||||||
return VueRouterReplace.call(this, location)
|
return VueRouterReplace.call(this, location).catch(err => err)
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.use(VueRouter)
|
Vue.use(VueRouter)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const frameIn = [
|
|||||||
path: 'index',
|
path: 'index',
|
||||||
name: 'index',
|
name: 'index',
|
||||||
meta: {
|
meta: {
|
||||||
|
title: '首页',
|
||||||
auth: true
|
auth: true
|
||||||
},
|
},
|
||||||
component: _import('system/index')
|
component: _import('system/index')
|
||||||
|
|||||||
@@ -113,6 +113,24 @@ export default {
|
|||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @class opened
|
||||||
|
* @description 重排页面列表上的某一项
|
||||||
|
* @param {Object} context
|
||||||
|
* @param {Object} payload { oldIndex, newIndex } 位置信息
|
||||||
|
*/
|
||||||
|
openedSort ({ state, commit, dispatch }, { oldIndex, newIndex }) {
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
// 重排页面列表某一项
|
||||||
|
let page = state.opened[oldIndex]
|
||||||
|
state.opened.splice(oldIndex, 1)
|
||||||
|
state.opened.splice(newIndex, 0, page)
|
||||||
|
// 持久化
|
||||||
|
await dispatch('opened2db')
|
||||||
|
// end
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* @class opened
|
* @class opened
|
||||||
* @description 新增一个 tag (打开一个页面)
|
* @description 新增一个 tag (打开一个页面)
|
||||||
|
|||||||
Reference in New Issue
Block a user