|
@@ -44,6 +44,7 @@ import {
|
|
|
Watch,
|
|
|
Emit
|
|
|
} from "vue-property-decorator";
|
|
|
+import { Loading } from "element-ui";
|
|
|
interface IPageResult {
|
|
|
rows: any[];
|
|
|
total: number;
|
|
@@ -68,6 +69,7 @@ export default class extends Vue {
|
|
|
private count: number | null = null;
|
|
|
private items: any[] = [];
|
|
|
private loading = false;
|
|
|
+ @Watch("$i18n.locale", { immediate: true })
|
|
|
@Watch("params", { immediate: true, deep: true })
|
|
|
reload() {
|
|
|
if (!this.params) return;
|
|
@@ -82,6 +84,11 @@ export default class extends Vue {
|
|
|
async load(pageNum: number) {
|
|
|
if (this.loading) return;
|
|
|
this.loading = true;
|
|
|
+ const loading = Loading.service({
|
|
|
+ fullscreen: true,
|
|
|
+ text: "数据加载中..."
|
|
|
+ });
|
|
|
+ this.items = this.pageType === "increase" ? this.items : [];
|
|
|
const [err, { rows = [], total = 0 }] = await this.$post<IPageResult>(
|
|
|
this.url,
|
|
|
Object.assign(this.params, {
|
|
@@ -91,7 +98,9 @@ export default class extends Vue {
|
|
|
);
|
|
|
this.count = total;
|
|
|
this.items = [...(this.pageType === "increase" ? this.items : []), ...rows];
|
|
|
+ loading.close();
|
|
|
this.loading = false;
|
|
|
+
|
|
|
return this.items;
|
|
|
}
|
|
|
}
|