Browse Source

请求数量方法

yangc 8 years ago
parent
commit
93497c4636
2 changed files with 24 additions and 0 deletions
  1. 11 0
      store/loading.js
  2. 13 0
      store/loading/searchCount.js

+ 11 - 0
store/loading.js

@@ -0,0 +1,11 @@
+export const actions = {
+// 搜索请求
+  setCount ({ commit }, params = {}) {
+    if (params.count) {
+      commit('searchCount/SET_COUNT_ADD')
+    } else {
+      commit('searchCount/SET_COUNT')
+    }
+  }
+}
+

+ 13 - 0
store/loading/searchCount.js

@@ -0,0 +1,13 @@
+export const state = () => ({
+  count: 0
+})
+
+export const mutations = {
+  SET_COUNT_ADD (state) {
+    state.count ++
+  },
+  SET_COUNT (state, result) {
+    state.count = result
+  }
+}
+