-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
47 lines (41 loc) · 863 Bytes
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default {
namespaced: true,
state: {
windowSize: {
width: undefined,
height: undefined
},
currentBreakpoint: 'xs',
windowScroll: 0,
// Dublicated in 'styles/core/_variables.scss'
breakpoints: {
xs: 576,
sm: 768,
md: 992,
lg: 1200,
xl: 1400
},
},
mutations: {
SAVE_WINDOW_WIDTH(state, params) {
Object.keys(params).forEach(key => {
state.windowSize[key] = params[key]
})
},
SAVE_CURRENT_BREAKPOINT(state, width) {
Object.entries(state.breakpoints).forEach(entry => {
if (width >= [entry[1]]) {
state.currentBreakpoint = entry[0]
}
})
},
SAVE_WINDOW_SCROLL(state, data) {
state.windowScroll = data
},
},
actions: {
},
}