Package Exports
- @1-week/vue-use-axios
- @1-week/vue-use-axios/lib/index.cjs.js
- @1-week/vue-use-axios/lib/index.esm.js
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-axiosUsage
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