@1-week/vue-use-axios
TypeScript icon, indicating that this package has built-in type declarations

0.2.16 • Public • Published

@vueblocks/vue-use-axios

Use Axios With Composition API Easily.

Install

yarn add @vueblocks/vue-use-axios

Usage

useAxios is a wrapper of Axios

import { useAxios } from '@vueblocks/vue-use-axios'

export default {
  ...
  setup () {
    const url = 'https://api.coindesk.com/v1/bpi/currentprice.json'

    const { refetch, data } = useAxios(url)

    const fetchBitcoinPrice = () => {
      setInterval(() => {
        refetch()
      }, 20000)
    }

    return {
      data,
      fetchBitcoinPrice
    }
  }
  ...
}

License

MIT @xiaoluoboding

Package Sidebar

Install

npm i @1-week/vue-use-axios

Weekly Downloads

8

Version

0.2.16

License

MIT

Unpacked Size

10.8 kB

Total Files

8

Last publish

Collaborators

  • 1-week