Skip to content

QingWei-Li/vuetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vuetch (Vue + fetch) [🚧 WIP]

Build Status Coverage Status npm

👻 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

About

👻 [WIP]A Vue 2.0 component that fetches data from a http request.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published