forked from dongyuanxin/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b73f9fc
commit 3119972
Showing
5 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<div class="my-loader center" v-show="show"> | ||
<div class="my-loader-circle"></div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data () { | ||
return { | ||
show: false | ||
} | ||
}, | ||
mounted () { | ||
this.$router.beforeEach((to, from, next) => { | ||
if (to.path !== from.path) { | ||
this.show = true | ||
next() | ||
} else { | ||
next() | ||
} | ||
}) | ||
this.$router.afterEach((to, from) => { | ||
this.show = false | ||
}) | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.center { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
.my-loader { | ||
background: rgba(0, 0, 0, 0.8); | ||
position: fixed; | ||
left: 0; | ||
top: 0; | ||
width: 100vw; | ||
height: 100vh; | ||
z-index: 600; | ||
} | ||
.my-loader-circle { | ||
z-index: 900; | ||
border: 3px solid#f6ffed; | ||
border-top: 3px solid #3eaf7c; | ||
border-radius: 50%; | ||
transform: rotate(0deg); | ||
width: 3.5em; | ||
height: 3.5em; | ||
animation: circle-rotate 1s linear infinite; | ||
} | ||
@keyframes circle-rotate { | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const path= require('path') | ||
|
||
module.exports = { | ||
enhanceAppFiles: path.resolve(__dirname, 'loader.js'), | ||
globalUIComponents: 'Loader' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Loader from './Loader.vue' | ||
|
||
export default ({ Vue }) => { | ||
Vue.component('Loader', Loader) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters