Last active
April 20, 2020 05:36
-
-
Save marcus-herrmann/eab6aa03dad6eafabb193e3e5d644f3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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