ソースを参照

loading样式修改

yangc 8 年 前
コミット
8e6ba45f56
4 ファイル変更38 行追加26 行削除
  1. 36 0
      components/common/loading/Loading.vue
  2. 2 2
      nuxt.config.js
  3. 0 11
      store/loading.js
  4. 0 13
      store/loading/searchCount.js

+ 36 - 0
components/common/loading/Loading.vue

@@ -0,0 +1,36 @@
+<template lang="html">
+  <div class="loading" v-if="loading">
+    <img src="/images/all/loading.gif" alt="">
+  </div>
+</template>
+<script>
+  export default {
+    data: () => ({
+      loading: false
+    }),
+    methods: {
+      start () {
+        this.loading = true
+      },
+      finish () {
+        this.loading = false
+      }
+    }
+  }
+</script>
+<style scoped>
+  .loading {
+    position: fixed;
+    top: 0;
+    left: 0;
+    right: 0;
+    width:  100%;
+    height: 100%;
+    z-index: 1000;
+    text-align: center;
+  }
+  .loading img {
+    position: relative;
+    top: 40%;
+  }
+</style>

+ 2 - 2
nuxt.config.js

@@ -23,9 +23,9 @@ module.exports = {
     ]
   },
   /*
-  ** Customize the progress-bar color
+  ** loading Style
   */
-  loading: { color: '#3B8070' },
+  loading: '~components/common/loading/Loading.vue',
   /*
   ** Build configuration
   */

+ 0 - 11
store/loading.js

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

+ 0 - 13
store/loading/searchCount.js

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