mirror of https://github.com/sundowndev/http.git
Update readme with how to use in component methods
The readme isn't super clear on how to use the module outside of the specific cases that are mentioned in the _Usage_ section. This just adds a small example of using it in the component `methods`.master
parent
bbee76048c
commit
34670079fa
17
README.md
17
README.md
|
@ -35,7 +35,7 @@
|
|||
- [Features](#features)
|
||||
- [Setup](#setup)
|
||||
- [Usage](#usage)
|
||||
- [Component](#component-asyncdata)
|
||||
- [Component](#component)
|
||||
- [Store](#store-nuxtserverinit)
|
||||
- [Store Actions](#store-actions)
|
||||
- [Options](#options)
|
||||
|
@ -93,7 +93,9 @@ Install with yarn:
|
|||
|
||||
## Usage
|
||||
|
||||
### Component `asyncData`
|
||||
### Component
|
||||
|
||||
**`asyncData`**
|
||||
|
||||
```js
|
||||
async asyncData({ app }) {
|
||||
|
@ -102,6 +104,17 @@ async asyncData({ app }) {
|
|||
}
|
||||
```
|
||||
|
||||
**`methods`/`created`/`mounted`/etc**
|
||||
|
||||
```js
|
||||
methods: {
|
||||
async fetchSomething() {
|
||||
const ip = await this.$axios.$get('http://icanhazip.com')
|
||||
this.ip = ip
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Store `nuxtServerInit`
|
||||
```js
|
||||
async nuxtServerInit ({ commit }, { app }) {
|
||||
|
|
Loading…
Reference in New Issue