mirror of
https://github.com/iczer/vue-antd-admin
synced 2025-04-06 04:00:06 +08:00
refactor: remove enquireScreen function from device.js to util.js; 🌟
重构:把 enquireScreen 功能从 device.js 迁移至 util.js;
This commit is contained in:
parent
192d4f243d
commit
685f5f5c4e
@ -5,8 +5,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import enquireScreen from './utils/device'
|
||||
import {mapState} from 'vuex'
|
||||
import {enquireScreen} from './utils/util'
|
||||
import {mapState, mapMutations} from 'vuex'
|
||||
import themeUtil from '@/utils/themeUtil';
|
||||
import {getI18nKey} from '@/utils/routerUtil'
|
||||
|
||||
@ -20,9 +20,7 @@ export default {
|
||||
created () {
|
||||
this.setHtmlTitle()
|
||||
this.setLanguage(this.lang)
|
||||
enquireScreen(isMobile => {
|
||||
this.$store.commit('setting/setDevice', isMobile)
|
||||
})
|
||||
enquireScreen(isMobile => this.setDevice(isMobile))
|
||||
},
|
||||
mounted() {
|
||||
this.setWeekModeTheme(this.weekMode)
|
||||
@ -54,6 +52,7 @@ export default {
|
||||
...mapState('setting', ['theme', 'weekMode', 'lang'])
|
||||
},
|
||||
methods: {
|
||||
...mapMutations('setting', ['setDevice']),
|
||||
setWeekModeTheme(weekMode) {
|
||||
if (weekMode) {
|
||||
document.body.classList.add('week-mode')
|
||||
|
@ -1,15 +0,0 @@
|
||||
import enquireJs from 'enquire.js'
|
||||
|
||||
const enquireScreen = function (call) {
|
||||
const hanlder = {
|
||||
match: function () {
|
||||
call && call(true)
|
||||
},
|
||||
unmatch: function () {
|
||||
call && call(false)
|
||||
}
|
||||
}
|
||||
enquireJs.register('only screen and (max-width: 767.99px)', hanlder)
|
||||
}
|
||||
|
||||
export default enquireScreen
|
Loading…
x
Reference in New Issue
Block a user