JSPM

@1-week/vue-use-axios

0.2.12
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q39102F
  • License MIT

Use Axios With Composition API Easily.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@1-week/vue-use-axios) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @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