vuetch

0.0.2 • Public • Published

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

Package Sidebar

Install

npm i vuetch

Weekly Downloads

9

Version

0.0.2

License

MIT

Last publish

Collaborators

  • qingwei.li