2.1.10 • Published 2 years ago

vue-http-fast v2.1.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vue-http-fast

simplly http request in vue component

How to install

yarn add vue-http-fast
# or
npm i vue-http-fast
import vueHttpFast from 'vue-http-fast';

// in Vue 2
Vue.use(vueHttpFast, { ...options });

// in Vue 3
App.use(vueHttpFast, { ...options });

// Option Example
options = {
  async launch(api, method, data, headers) {
    return axios({
      method: 'get',
      url: api,
      data,
      headers,
    });
  },
};

How to use

<http api="..." method="get" :params="{ hello: 'world' }" v-slot="{ data }">
  <div>{{ data }}</div>
</http>

How to Secondary Request

// Refresh according to the method set on the component
this.$refs.http.refresh(params, headers);

// Send request as method get
this.$refs.http.get(params, headers);

// Send request as method post
this.$refs.http.get(params, headers);

Or it can be written in template like

<http api="..." ref="http">
  <div>{{ data }}</div>

  <button @click="$refs.http.refresh">refresh</button>
  <button @click="$refs.http.get({ respect: false })">get</button>
  <button @click="$refs.http.post({ respect: true })">post</button>
</http>

Tip

vue-http-fast do not have the ability to send requests, you need to configure the request class during registration

Docs

NameTypeDefaultDescription
apiString''address for request
methodStringgetbe used when making the request
paramsObject{}be sent with the request
immediateBooleantrueset request be sended immediately
waitBooleantrueset rending after response
httpPromisenonereset tool of sending requests
requestInterceptorPromise(data, headers) => ({ data, headers })interceptor before request
responseInterceptorPromiseresult => resultinterceptor after response
2.1.10

2 years ago

2.1.9

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.2

2 years ago

1.0.0

2 years ago