Skip to content

Instantly share code, notes, and snippets.

@marcus-herrmann
Last active April 20, 2020 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcus-herrmann/eab6aa03dad6eafabb193e3e5d644f3a to your computer and use it in GitHub Desktop.
Save marcus-herrmann/eab6aa03dad6eafabb193e3e5d644f3a to your computer and use it in GitHub Desktop.
<template>
<h2>Latest News</h2>
<p>{{ news }}</p>
</template>
<script>
export default {
async setup(props, context) {
const promise = new Promise((resolve) => {
setTimeout(function () {
context.emit("newscomplete");
resolve("Trump resigns");
}, 2000)
});
const news = await promise;
return {
news
}
}
}
</script>
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<Fragments />
<Suspense>
<template #default>
<LatestNews @newscomplete="newscomplete" />
</template>
<template #fallback>
<div>Loading...</div>
</template>
</Suspense>
</div>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment