transition

Former-commit-id: 02bd7f913030974f8fea14eca765da453cad40f1 [formerly 02bd7f913030974f8fea14eca765da453cad40f1 [formerly 02bd7f913030974f8fea14eca765da453cad40f1 [formerly 02bd7f913030974f8fea14eca765da453cad40f1 [formerly c80358c9fd4064bdcbb3e8208cdae8960ad29c76 [formerly 339084b596728ca59169ccee025cd5cfb04cc0ea]]]]]
Former-commit-id: 0eca34a7cefeac571a42b089b7b606bb0b58321e
Former-commit-id: 66da672644dbfbe7ced81383b12a48db14eef43e
Former-commit-id: 6580885c5fc24b70ab60017af72f33a9a17a7816 [formerly e217ea71e67a326b82c2dead714fd845af6451d5]
Former-commit-id: c8f62875e94b755e14caff6e1f43fada83b5cadf
Former-commit-id: 54e5871a85ecbb0e8e23c9359fab455f4d096457
Former-commit-id: 4e15d8fa611c28e7750c974cfd95e43ef6031f7a
Former-commit-id: ab1da431925c17c7ff42f73d54897e72a98aa092
Former-commit-id: 6f8297b77f9bf5d960a74cbc6ac787e58241b42f
This commit is contained in:
liyang
2018-09-14 09:02:49 +08:00
parent a057d7ddd4
commit 8c3c2f81eb
3 changed files with 28 additions and 20 deletions

View File

@@ -10,7 +10,7 @@
</template>
<script>
import { mapState, mapMutations } from 'vuex'
import { mapState, mapActions } from 'vuex'
export default {
computed: {
...mapState('d2admin/transition', [
@@ -18,7 +18,7 @@ export default {
])
},
methods: {
...mapMutations('d2admin/transition', [
...mapActions('d2admin/transition', [
'set'
])
}

View File

@@ -100,7 +100,7 @@ export default {
// DB -> store 加载主题
await dispatch('d2admin/theme/load', null, { root: true })
// DB -> store 加载页面过渡效果设置
commit('d2admin/transition/load', null, { root: true })
await dispatch('d2admin/transition/load', null, { root: true })
// DB -> store 持久化数据加载上次退出时的多页列表
commit('d2admin/page/openedLoad', null, { root: true })
// DB -> store 持久化数据加载侧边栏折叠状态

View File

@@ -7,34 +7,42 @@ export default {
// 是否开启页面过度动画
active: setting.transition.active
},
mutations: {
actions: {
/**
* @description 设置开启状态
* @param {Object} state vuex state
* @param {Boolean} active 新的状态
*/
set (state, active) {
// store 赋值
state.active = active
// 持久化
this.dispatch('d2admin/db/set', {
dbName: 'sys',
path: 'transition.active',
value: state.active,
user: true
set ({ state, dispatch }, active) {
return new Promise(async resolve => {
// store 赋值
state.active = active
// 持久化
await dispatch('d2admin/db/set', {
dbName: 'sys',
path: 'transition.active',
value: state.active,
user: true
}, { root: true })
// end
resolve()
})
},
/**
* 从数据库读取页面过渡动画设置
* @param {Object} state vuex state
*/
async load (state) {
// store 赋值
state.active = await this.dispatch('d2admin/db/get', {
dbName: 'sys',
path: 'transition.active',
defaultValue: setting.transition.active,
user: true
load ({ state, dispatch }) {
return new Promise(async resolve => {
// store 赋值
state.active = await dispatch('d2admin/db/get', {
dbName: 'sys',
path: 'transition.active',
defaultValue: setting.transition.active,
user: true
}, { root: true })
// end
resolve()
})
}
}