Created
October 9, 2018 23:31
-
-
Save superMDguy/0823d28b1addfd77d910752e443d8adf 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> | |
| <div class="wrapper"> | |
| <div class="empty-message" v-if="articlesTask.empty"> | |
| No articles | |
| </div> | |
| <div class="spinner" v-if="articlesTask.spinning"> | |
| Loading articles... | |
| </div> | |
| <div class="error-message" v-if="articlesTask.error"> | |
| {{ articlesTask.error.message }} | |
| </div> | |
| <ul v-if="articlesTask.hasValue"> | |
| <li v-for="article in articles"> | |
| {{ article.title }} | |
| </li> | |
| </ul> | |
| </div> | |
| </template> | |
| <script> | |
| import tuxi from 'tuxi' | |
| import api from './api' | |
| export default { | |
| data() { | |
| return { | |
| articlesTask: tuxi.task(api.fetchArticles) | |
| } | |
| }, | |
| computed: { | |
| articles() { | |
| return this.articlesTask.value | |
| } | |
| } | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment