diff --git a/src/components/widgets/loading/loading.vue b/src/components/widgets/loading/loading.vue index f2d0777..89b90ad 100644 --- a/src/components/widgets/loading/loading.vue +++ b/src/components/widgets/loading/loading.vue @@ -44,7 +44,7 @@ export default { width: 270rpx; margin: 0 auto; transform: translateY(-50%); - background-color: #646464; + background-color: #4e4e4e; box-sizing: border-box; padding: 20rpx; border-radius: 10rpx; diff --git a/src/core/libs/loading.js b/src/core/libs/loading.js index ba95314..601a902 100644 --- a/src/core/libs/loading.js +++ b/src/core/libs/loading.js @@ -1,12 +1,21 @@ import $store from '@/store/index' export default { + timer: null, + timeout: 10, show(title) { + clearTimeout(this.timer); $store.commit('loading/show', true); if (title) { $store.commit('loading/title', title); } + // 10秒后自动hide + let that = this; + this.timer = setTimeout(() => { + that.hide(); + }, this.timeout * 1000); }, hide() { + clearTimeout(this.timer); $store.commit('loading/show', false); $store.commit('loading/title', ""); }