add loading
This commit is contained in:
1 parent
c7317334cf
commit
d9d2c59295
7 files changed
+75
-10
No files matched your search
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<full-loading
|
||||
v-model:active="showing"
|
||||
color="#409eff"
|
||||
loader="bars"
|
||||
:opacity="0.8"
|
||||
:can-cancel="true"
|
||||
:on-cancel="undefined"
|
||||
:is-full-page="true"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import FullLoading from 'vue-loading-overlay';
|
||||
import 'vue-loading-overlay/dist/vue-loading.css';
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Loading',
|
||||
components: {
|
||||
FullLoading
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showing: false
|
||||
};
|
||||
},
|
||||
props: {
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
delay: {
|
||||
type: Number,
|
||||
default: 200
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
loading: {
|
||||
handler(val, oldVal) {
|
||||
if (oldVal === true && val === false) {
|
||||
setTimeout(() => {
|
||||
this.showing = val;
|
||||
}, this.delay);
|
||||
} else {
|
||||
this.showing = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -7,8 +7,7 @@
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-menu :default-active="active" class="el-menu-demo" mode="horizontal" @select="onSelect">
|
||||
<el-menu-item index="home" v-t="'common.nav.home'" v-if="false"></el-menu-item>
|
||||
<el-menu-item index="editor" v-t="'common.nav.editor'"></el-menu-item>
|
||||
<el-menu-item index="/content" v-t="'common.nav.content'"></el-menu-item>
|
||||
</el-menu>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -26,14 +25,13 @@ export default defineComponent({
|
||||
},
|
||||
computed: {
|
||||
active() {
|
||||
return this.$route.name;
|
||||
console.log('this.$route', this.$route);
|
||||
return this.$route.matched[0].path;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect(val: string) {
|
||||
this.$router.push({
|
||||
name: val
|
||||
});
|
||||
this.$router.push(val);
|
||||
},
|
||||
onHome() {
|
||||
this.$router.push({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import TopHeader from './TopHeader.vue';
|
||||
import Breadcrumb from './Breadcrumb.vue';
|
||||
|
||||
export { TopHeader, Breadcrumb };
|
||||
import Loading from './Loading.vue';
|
||||
export { TopHeader, Breadcrumb, Loading };
|
||||
Reference in new issue
Block a user