|
@@ -1,5 +1,5 @@
|
|
|
|
|
|
-import { DEVICE_TYPE } from '@/utils/device'
|
|
|
+import { deviceEnquire, DEVICE_TYPE } from '@/utils/device'
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
|
|
|
@@ -50,4 +50,24 @@ const mixinDevice = {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export { mixin, mixinDevice }
|
|
|
+const AppDeviceEnquire = {
|
|
|
+ mounted () {
|
|
|
+ const { $store } = this
|
|
|
+ deviceEnquire(deviceType => {
|
|
|
+ switch (deviceType) {
|
|
|
+ case DEVICE_TYPE.DESKTOP:
|
|
|
+ $store.commit('TOGGLE_DEVICE', 'desktop')
|
|
|
+ break
|
|
|
+ case DEVICE_TYPE.TABLET:
|
|
|
+ $store.commit('TOGGLE_DEVICE', 'tablet')
|
|
|
+ break
|
|
|
+ case DEVICE_TYPE.MOBILE:
|
|
|
+ default:
|
|
|
+ $store.commit('TOGGLE_DEVICE', 'mobile')
|
|
|
+ break
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export { mixin, AppDeviceEnquire, mixinDevice }
|