From: Eduardo San Martin Morote Date: Sun, 15 Mar 2020 19:05:20 +0000 (+0100) Subject: docs: data fetching with suspense X-Git-Tag: v4.0.0-alpha.4~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ddc9b42e1037c751c544b2f55cfccb68c50f9f3;p=thirdparty%2Fvuejs%2Frouter.git docs: data fetching with suspense --- diff --git a/playground/App.vue b/playground/App.vue index d3c51661..2c63a485 100644 --- a/playground/App.vue +++ b/playground/App.vue @@ -114,7 +114,14 @@ @before-enter="flushWaiter" @before-leave="setupWaiter" > --> - + + + + diff --git a/playground/api/index.ts b/playground/api/index.ts new file mode 100644 index 00000000..628521c9 --- /dev/null +++ b/playground/api/index.ts @@ -0,0 +1,11 @@ +export let delay = (t: number = 100) => + new Promise(resolve => setTimeout(resolve, t)) + +export async function getData() { + await delay(500) + + return { + message: 'Hello', + time: Date.now(), + } +} diff --git a/playground/views/ComponentWithData.vue b/playground/views/ComponentWithData.vue index 0d32d830..857018b0 100644 --- a/playground/views/ComponentWithData.vue +++ b/playground/views/ComponentWithData.vue @@ -1,23 +1,31 @@