Commit 1f60f65b by Sendya

add enquire

parent e3ab40e4
......@@ -12,6 +12,7 @@
"ant-design-vue": "^1.0.3",
"axios": "^0.18.0",
"dayjs": "^1.7.5",
"enquire.js": "^2.1.6",
"js-cookie": "^2.2.0",
"md5": "^2.2.1",
"nprogress": "^0.2.0",
......
......@@ -7,12 +7,24 @@
</template>
<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import enquireScreen from '@/utils/device'
export default {
data () {
return {
locale: zhCN,
}
},
created () {
let that = this
enquireScreen(isMobile => {
if (isMobile) {
that.$store.commit('app/TOGGLE_DEVICE', true)
} else {
that.$store.commit('app/TOGGLE_SIDEBAR', true)
}
})
}
}
</script>
......
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
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment