-
-
Notifications
You must be signed in to change notification settings - Fork 188
/
Copy pathvue-script-vuex.json
109 lines (109 loc) · 2.41 KB
/
vue-script-vuex.json
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
"Vuex Store": {
"prefix": "vstore",
"body": [
"import Vue from 'vue';",
"import Vuex from 'vuex';",
"",
"Vue.use(Vuex);",
"",
"export const store = new Vuex.Store({",
"\tstate: {",
"\t\t${1:key}: ${2:value}",
"\t}",
"});"
],
"description": "Base for Vuex store"
},
"Vuex Getters": {
"prefix": "vgetter",
"body": [
"getters: {",
"\t${1:value}: state => {",
"\t\treturn state.${1:value};",
"\t}",
"}"
],
"description": "vuex getter"
},
"Vuex Mutation": {
"prefix": "vmutation",
"body": [
"mutations: {",
"\t${1:updateValue}(state, ${3:payload}) {",
"\t\tstate.${2:value} = ${3:payload};",
"\t}",
"}"
],
"description": "vuex mutation"
},
"Vuex Action": {
"prefix": "vaction",
"body": [
"actions: {",
"\t${1:updateValue}({commit}, ${2:payload}) {",
"\t\tcommit('${1:updateValue}', ${2:payload});",
"\t}",
"}"
],
"description": "vuex action"
},
"Vue Import Vuex Store": {
"prefix": "vstore-import",
"body": ["import { store } from './store/index';"],
"description": "import vuex store into main.js"
},
"Vuex Module": {
"prefix": "vmodule",
"body": [
"export default {",
"\tstate: {",
"\t\tvalue: 'my value'",
"\t},",
"\tgetters: {",
"\t\tvalue: state => {",
"\t\t\treturn state.value;",
"\t\t}",
"\t},",
"\tmutations: {",
"\t\tupdateValue(state, payload) {",
"\t\t\tstate.value = payload;",
"\t\t}",
"\t},",
"\tactions: {",
"\t\tupdateValue({commit}, payload) {",
"\t\t\tcommit('updateValue', payload);",
"\t\t}",
"\t}",
"};"
],
"description": "vuex module"
},
"Vuex Store 2": {
"prefix": "vstore2",
"body": [
"export const state = () => ({",
"\tvalue: 'myvalue'",
"})",
"",
"export const getters = {",
"\tgetterValue: state => {",
"\t\treturn state.value",
"\t}",
"}",
"",
"export const mutations = {",
"\tupdateValue: (state, payload) => {",
"\t\tstate.value = payload",
"\t}",
"}",
"",
"export const actions = {",
"\tupdateActionValue({ commit }) {",
"\t\tcommit('updateValue', payload)",
"\t}",
"}"
],
"description": "vuex store 2"
}
}