Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Commit

Permalink
style(loading): 修改loading表现细节
Browse files Browse the repository at this point in the history
  • Loading branch information
mzz2017 committed May 18, 2018
1 parent 353e05b commit a7ac3dc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/base/loading/loading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</div>
</div>
</div>
<p class="refresh" v-show="progressValue===99" @click="location.reload(true)">刷新</p>
<div class="overlay" v-if="overlay"></div>
</div>
</transition>
Expand Down Expand Up @@ -44,6 +45,7 @@
}
},
mounted() {
//2500是因为我将所有axios请求timeout设为了2500ms
setTimeout(() => {
this.progressValue = Math.max(10, this.progressValue)
}, 250)
Expand All @@ -60,7 +62,7 @@
this.progressValue = Math.max(80, this.progressValue)
}, 2000)
setTimeout(() => {
this.progressValue = Math.max(100, this.progressValue)
this.progressValue = Math.max(99, this.progressValue)
}, 2500)
}
}
Expand Down
16 changes: 5 additions & 11 deletions src/common/scss/loading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ $--padding: 2px;
margin: 0;
font-family: 'HoangYen11';
}
.refresh {
font-size: 14px;
font-weight: bold;
cursor: pointer;
}
.progress-wrapper {
width: $--width;
height: $--progress-height;
Expand Down Expand Up @@ -71,14 +76,3 @@ $--padding: 2px;
background: rgba(0, 0, 0, .1);
}
}
.loading-fade-leave-active {
animation: loading-fade-out .3s;
}
@keyframes loading-fade-out {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
13 changes: 13 additions & 0 deletions src/common/scss/mainPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ $primary-blue: #409EFF;
margin: 10px auto;
}
}

.loading-fade-leave-active {
animation: loading-fade-out .3s;
}

@keyframes loading-fade-out {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
8 changes: 5 additions & 3 deletions src/components/mainPage/mainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
</div>
</div>
</el-dialog>
<loading v-show="isLoading"></loading>
<transition name="loading-fade">
<loading v-if="isLoading"></loading>
</transition>
</div>
</template>
<script>
Expand Down Expand Up @@ -218,7 +220,7 @@
songName: encodeURIComponent(this.searchContentKeeper),
pageSize: 15
},
timeout: 2500
timeout: 5000
}).then((response) => {
let array = []
process.env.NODE_ENV === 'development' && console.log(response.data.data)
Expand Down Expand Up @@ -289,7 +291,7 @@
axios({
url: '/api/vkey',
methods: 'get',
timeout: 2500
timeout: 5000
}).then((response) => {
let vkey = response.data.vkey
window.localStorage.setItem('vkey', vkey)
Expand Down
1 change: 1 addition & 0 deletions src/interceptor/interceptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ axios.interceptors.response.use((res) => {
store.commit('changeLoadingState', false)
return res
}, (error) => {
store.commit('changeLoadingState', false)
return Promise.reject(error)
})

0 comments on commit a7ac3dc

Please sign in to comment.