Skip to content

Commit 3c737fa

Browse files
author
郑培鑫
committed
docs: update docs
1 parent 7e7c59d commit 3c737fa

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

README.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ Import to the component.
103103
<!-- demo.vue -->
104104
105105
<script setup lang="js">
106+
import { ref } from 'vue';
107+
106108
const useRun = (api) => {
107109
const loading = ref(false);
108110
const error = ref(false);
@@ -123,12 +125,14 @@ Import to the component.
123125
};
124126
125127
const data = ref([]);
126-
const api = () => {
127-
// Simulate a request, usually return a Promise
128-
return setTimeout(() => {
129-
data.value = Array.from({ length: 10 }, (v, k) => k);
130-
}, 1000);
131-
};
128+
// Simulate a request
129+
const api = () =>
130+
new Promise((resolve, reject) => {
131+
setTimeout(() => {
132+
data.value = Array.from({ length: 10 }, (v, k) => k);
133+
resolve();
134+
}, 2000);
135+
});
132136
133137
const [loading, error, init] = useRun(api);
134138
@@ -429,7 +433,7 @@ All directives will automatically adjust their height according to the container
429433
<!-- demo.vue -->
430434
431435
<template>
432-
<div v-empty="true" style="{height: 1000px;}"></div>
436+
<div v-empty="true" style="height: 500px;"></div>
433437
<div v-empty="true"></div>
434438
</template>
435439
```
@@ -442,8 +446,8 @@ The maximum icon size can be adjusted using the `iconMaxSize` or the `vdp-empty-
442446
<template>
443447
<div
444448
v-empty="true"
445-
style="{height: 1000px;}"
446-
vdp-empty-icon-max-size="500"
449+
style="height: 500px;"
450+
vdp-empty-icon-max-size="400"
447451
></div>
448452
</template>
449453
```

README.zh-CN.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ app.use(vdpLoading);
101101
<!-- demo.vue -->
102102
103103
<script setup lang="js">
104+
import { ref } from 'vue';
105+
104106
const useRun = (api) => {
105107
const loading = ref(false);
106108
const error = ref(false);
@@ -121,12 +123,14 @@ app.use(vdpLoading);
121123
};
122124
123125
const data = ref([]);
124-
const api = () => {
125-
// 模拟请求,一般是返回 Promise 对象
126-
return setTimeout(() => {
127-
data.value = Array.from({ length: 10 }, (v, k) => k);
128-
}, 1000);
129-
};
126+
// 模拟请求
127+
const api = () =>
128+
new Promise((resolve, reject) => {
129+
setTimeout(() => {
130+
data.value = Array.from({ length: 10 }, (v, k) => k);
131+
resolve();
132+
}, 2000);
133+
});
130134
131135
const [loading, error, init] = useRun(api);
132136
@@ -427,7 +431,7 @@ app.use(vueDefaultPage, {
427431
<!-- demo.vue -->
428432
429433
<template>
430-
<div v-empty="true" style="{height: 1000px;}"></div>
434+
<div v-empty="true" style="height: 500px;"></div>
431435
<div v-empty="true"></div>
432436
</template>
433437
```
@@ -440,8 +444,8 @@ app.use(vueDefaultPage, {
440444
<template>
441445
<div
442446
v-empty="true"
443-
style="{height: 1000px;}"
444-
vdp-empty-icon-max-size="500"
447+
style="height: 500px;"
448+
vdp-empty-icon-max-size="400"
445449
></div>
446450
</template>
447451
```

0 commit comments

Comments
 (0)