0.0.2 • Published 7 years ago
vuetch v0.0.2
vuetch (Vue + fetch) 🚧 WIP
👻 A Vue 2.0 component that fetches data from a http request.
Sometimes we just want to requrest an api and display data in the view. Why not write directly in the template.🤔
Features
- Supports fetch and other HTTP clients(axios, vue-resource, etc.)
- Supports polling
- Simplify your code
Installation
yarn add vuetch
# npm i vuetch -S
Usage
import Vuetch from 'vuetch'
import Vue from 'vue'
Vue.use(Vuetch)
<vuetch url="https://api.github.com/users/QingWei-Li">
<template scope="props">
<pre>{{ props.data }}</pre>
<pre>{{ props.error }}</pre>
<div>{{ props.loading }}</div>
</template>
</vuetch>
API
Props
- url
- options
- http
- loop
- delay
- immediate
- defaultData
- manual
Events
- onerror
- onsuccess
- oncomplete
Scoped props
- data
- error
- $load
- $poll
TODO
- Documentation
- Demo
- Unit test
- Publish
License
MIT