vue-resource README

The project's README from github.com/pagekit/vue-resource. As one markdown file: README.md.

vue-resource Build Downloads jsdelivr Version License

The plugin for Vue.js provides services for making web requests and handle responses using a XMLHttpRequest or JSONP.

Features

Installation

You can install it via yarn or NPM.

$ yarn add vue-resource
$ npm install vue-resource

CDN

Available on jsdelivr, unpkg or cdnjs.

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

Example

{
  // GET /someUrl
  this.$http.get('/someUrl').then(response => {

    // get body data
    this.someData = response.body;

  }, response => {
    // error callback
  });
}

Documentation

Changelog

Details changes for each release are documented in the release notes.

Contribution

If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.

License

MIT

vue-resource (pagekit/vue-resource)

Searching Database…

10K ·GitHub
archived
这是什么?vue-resource 是 Vue.js 的 HTTP 客户端插件:它提供发起网页请求的服务,可以通过 XMLHttpRequest 或 JSONP 发请求,并在 Vue 应用里处理响应。
它是一个独立的 HTTP 客户端,还是要加到我的 Vue 应用里的插件?是 Vue.js 的插件——你要在已有的 Vue 项目里注册它,而不是单独使用。它是一个只有 14KB 的轻量库(压缩后 5.3KB)。
怎么把它加到我的项目里?用 yarn 或 npm 安装,或者不用打包工具,直接从 CDN 引入——它发布在 jsdelivr、unpkg 和 cdnjs 上。
它支持哪些版本的 Vue?只需要 Vue 本身:这个插件支持 Vue 1.0 和 Vue 2.0,从未适配到 Vue 3。
新项目还适合选它吗?不适合——它的代码仓库已经归档,项目已停止维护,不会再有更新。只有现有的 Vue 1.x/2.x 项目还可以继续用它。
它能在哪些浏览器里运行?它在浏览器里运行:支持最新版的 Firefox、Chrome、Safari 和 Opera,以及 IE9 及更高版本。
除了普通的请求,它还有哪些功能?请求支持 Promise API,URL 可以用 URI Templates 来构建,还可以添加拦截器,在请求和响应的传递过程中对它们进行处理。
我可以在商业项目里用它吗?可以——vue-resource 采用 MIT 许可证,可以免费使用、修改和分发,包括用在商业应用里。
我的 Vue 2 应用已经在用它了,需要把它移除吗?没必要——现有应用可以继续正常工作,但仓库已归档意味着不会再有新版本、修复或安全更新,所以从长远来看它已经走到头了。
What are similar projects?q, fetch, vue-router, material, Respond, superagent, codemirror5, vuex
Creator
pagekit
Size
1.7 MB
Stars
10K
Age
12y
Commits · 90 Days