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: '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: '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"
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"quill": "^1.3.6",
|
||||
"screenfull": "^5.0.0",
|
||||
"simplemde": "^1.11.2",
|
||||
"sortablejs": "^1.10.1",
|
||||
"ua-parser-js": "^0.7.20",
|
||||
"v-charts": "^1.19.0",
|
||||
"v-contextmenu": "^2.9.0",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
@rowClick="contextmenuClick"/>
|
||||
</d2-contextmenu>
|
||||
<el-tabs
|
||||
class="d2-multiple-page-control"
|
||||
class="d2-multiple-page-control d2-multiple-page-sort"
|
||||
:value="current"
|
||||
type="card"
|
||||
:closable="true"
|
||||
@@ -60,6 +60,7 @@
|
||||
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import Sortable from 'sortablejs'
|
||||
export default {
|
||||
components: {
|
||||
D2Contextmenu: () => import('../contextmenu'),
|
||||
@@ -94,7 +95,8 @@ export default {
|
||||
'closeLeft',
|
||||
'closeRight',
|
||||
'closeOther',
|
||||
'closeAll'
|
||||
'closeAll',
|
||||
'openedSort'
|
||||
]),
|
||||
/**
|
||||
* @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>
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
}"
|
||||
flex-box="0"
|
||||
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-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`">
|
||||
</div>
|
||||
</router-link>
|
||||
<div class="toggle-aside-btn" @click="handleToggleAside" flex-box="0">
|
||||
<d2-icon name="bars"/>
|
||||
</div>
|
||||
|
||||
@@ -14,11 +14,11 @@ import routes from './routes'
|
||||
// fix vue-router NavigationDuplicated
|
||||
const VueRouterPush = VueRouter.prototype.push
|
||||
VueRouter.prototype.push = function push (location) {
|
||||
return VueRouterPush.call(this, location)
|
||||
return VueRouterPush.call(this, location).catch(err => err)
|
||||
}
|
||||
const VueRouterReplace = VueRouter.prototype.replace
|
||||
VueRouter.prototype.replace = function replace (location) {
|
||||
return VueRouterReplace.call(this, location)
|
||||
return VueRouterReplace.call(this, location).catch(err => err)
|
||||
}
|
||||
|
||||
Vue.use(VueRouter)
|
||||
|
||||
@@ -26,6 +26,7 @@ const frameIn = [
|
||||
path: 'index',
|
||||
name: 'index',
|
||||
meta: {
|
||||
title: '首页',
|
||||
auth: true
|
||||
},
|
||||
component: _import('system/index')
|
||||
|
||||
@@ -113,6 +113,24 @@ export default {
|
||||
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
|
||||
* @description 新增一个 tag (打开一个页面)
|
||||
|
||||
Reference in New Issue
Block a user