add loading
This commit is contained in:
1 parent
c7317334cf
commit
d9d2c59295
7 files changed
+75
-10
No files matched your search
@@ -18,6 +18,7 @@
|
|||||||
"prettier": "^2.3.2",
|
"prettier": "^2.3.2",
|
||||||
"vue": "^3.2.6",
|
"vue": "^3.2.6",
|
||||||
"vue-i18n": "^9.1.7",
|
"vue-i18n": "^9.1.7",
|
||||||
|
"vue-loading-overlay": "^4.0",
|
||||||
"vue-router": "^4.0.11",
|
"vue-router": "^4.0.11",
|
||||||
"vuex": "^4.0.2"
|
"vuex": "^4.0.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-menu :default-active="active" class="el-menu-demo" mode="horizontal" @select="onSelect">
|
<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="/content" v-t="'common.nav.content'"></el-menu-item>
|
||||||
<el-menu-item index="editor" v-t="'common.nav.editor'"></el-menu-item>
|
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -26,14 +25,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
active() {
|
active() {
|
||||||
return this.$route.name;
|
console.log('this.$route', this.$route);
|
||||||
|
return this.$route.matched[0].path;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSelect(val: string) {
|
onSelect(val: string) {
|
||||||
this.$router.push({
|
this.$router.push(val);
|
||||||
name: val
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onHome() {
|
onHome() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import TopHeader from './TopHeader.vue';
|
import TopHeader from './TopHeader.vue';
|
||||||
import Breadcrumb from './Breadcrumb.vue';
|
import Breadcrumb from './Breadcrumb.vue';
|
||||||
|
import Loading from './Loading.vue';
|
||||||
export { TopHeader, Breadcrumb };
|
export { TopHeader, Breadcrumb, Loading };
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="16" :offset="4">
|
<el-col :span="16" :offset="4">
|
||||||
|
<loading :loading="loading" />
|
||||||
<div class="px-4 pt-4">
|
<div class="px-4 pt-4">
|
||||||
<div id="vditor" class="vditor" />
|
<div id="vditor" class="vditor" />
|
||||||
</div>
|
</div>
|
||||||
@@ -10,7 +11,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vditor from '@/libs/vditor/index';
|
import Vditor from '@/libs/vditor/index';
|
||||||
import { Breadcrumb } from '@/components/common/index';
|
import { Breadcrumb, Loading } from '@/components/common/index';
|
||||||
import { defaultOptions } from '@/settings/editor';
|
import { defaultOptions } from '@/settings/editor';
|
||||||
import '@/libs/vditor/assets/scss/index.scss';
|
import '@/libs/vditor/assets/scss/index.scss';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
@@ -26,7 +27,8 @@ interface IData {
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
Breadcrumb
|
Breadcrumb,
|
||||||
|
Loading
|
||||||
},
|
},
|
||||||
data(): IData {
|
data(): IData {
|
||||||
return {
|
return {
|
||||||
@@ -37,6 +39,7 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
this.loading = true;
|
||||||
ArticleService.get(this.id).then(({ data: data }: { data: IArticleDetailResponse }): void => {
|
ArticleService.get(this.id).then(({ data: data }: { data: IArticleDetailResponse }): void => {
|
||||||
console.log('data', data);
|
console.log('data', data);
|
||||||
this.item = data;
|
this.item = data;
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ export default {
|
|||||||
},
|
},
|
||||||
component: () => import('@/layouts/Content.vue'),
|
component: () => import('@/layouts/Content.vue'),
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
redirect: {
|
||||||
|
name: 'article-index'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'article',
|
path: 'article',
|
||||||
name: 'article-index',
|
name: 'article-index',
|
||||||
|
|||||||
@@ -2416,6 +2416,11 @@ vue-i18n@^9.1.7:
|
|||||||
"@intlify/vue-devtools" "9.1.7"
|
"@intlify/vue-devtools" "9.1.7"
|
||||||
"@vue/devtools-api" "^6.0.0-beta.7"
|
"@vue/devtools-api" "^6.0.0-beta.7"
|
||||||
|
|
||||||
|
vue-loading-overlay@^4.0:
|
||||||
|
version "4.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/vue-loading-overlay/-/vue-loading-overlay-4.0.4.tgz#8ddad8ca6b4d3e9eedf3805321e2fb08c0b52e74"
|
||||||
|
integrity sha512-ADIEUXLo+IEpK8hd2+iqhZtEV3m0WNh5FlGvAc6FWG0KJAEHGTGUFdugQgAtM6Y3iFZc/ovzMd7A9dN+7QC7hw==
|
||||||
|
|
||||||
vue-router@^4.0.11:
|
vue-router@^4.0.11:
|
||||||
version "4.0.11"
|
version "4.0.11"
|
||||||
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.0.11.tgz#cd649a0941c635281763a20965b599643ddc68ed"
|
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.0.11.tgz#cd649a0941c635281763a20965b599643ddc68ed"
|
||||||
|
|||||||
Reference in new issue
Block a user