Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lzxb/vue-methods-promise
Let Vue methods support return Promise
https://github.com/lzxb/vue-methods-promise
ajax ava axios es6 fetch request rollup vue vue-demo vue-methods vue-methods-promise vue-plugin vue-promise vue2 vue2-demo vuejs vuejs2
Last synced: 3 months ago
JSON representation
Let Vue methods support return Promise
- Host: GitHub
- URL: https://github.com/lzxb/vue-methods-promise
- Owner: lzxb
- Created: 2017-02-22T03:05:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-29T14:11:33.000Z (almost 8 years ago)
- Last Synced: 2024-10-12T08:48:33.517Z (3 months ago)
- Topics: ajax, ava, axios, es6, fetch, request, rollup, vue, vue-demo, vue-methods, vue-methods-promise, vue-plugin, vue-promise, vue2, vue2-demo, vuejs, vuejs2
- Language: JavaScript
- Homepage:
- Size: 49.8 KB
- Stars: 34
- Watchers: 6
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-vue - vue-methods-promise - 使vue方法支持promise (实用库)
- awesome-github-vue - vue-methods-promise - 使vue方法支持promise (实用库)
- awesome - vue-methods-promise - 使vue方法支持promise (实用库)
- awesome-vue - vue-methods-promise - methods-promise?style=social) - 使vue方法支持promise (实用库)
README
[![Build Status](https://travis-ci.org/lzxb/vue-methods-promise.svg?branch=master)](https://travis-ci.org/lzxb/vue-methods-promise)
[![dependencies Status](https://david-dm.org/lzxb/vue-methods-promise/status.svg)](https://david-dm.org/lzxb/vue-methods-promise)
[![devDependencies Status](https://david-dm.org/lzxb/vue-methods-promise/dev-status.svg)](https://david-dm.org/lzxb/vue-methods-promise?type=dev)
[![Known Vulnerabilities](https://snyk.io/test/npm/vue-methods-promise/badge.svg)](https://snyk.io/test/npm/vue-methods-promise)
[![npm](https://img.shields.io/npm/v/vue-methods-promise.svg?style=flat-square)](https://www.npmjs.com/package/vue-methods-promise)
[![npm](https://img.shields.io/npm/dt/vue-methods-promise.svg?style=flat-square)](https://www.npmjs.com/package/vue-methods-promise)# vue-methods-promise
```
Let Vue methods support promise
```### Usage
```
npm install --save vue-methods-promise
```
```javascript
// Installation
import Vue from 'vue'
import vueMethodsPromise from 'vue-methods-promise'Vue.use(vueMethodsPromise, {
hookName: '$promise', // Component default hook name
promise: (mp) => { // Promise callback
mp
.then((function (res) {
console.log(res)
})
.catch(function (err) {
console.log(err.msg) // Test error
})
}
})// Usage
export default {
mounted () {
this.test()
},
methods: { // All return Promise type, will be dealt with
test () {
return Promise.reject(new Error({ msg: 'Test error' }))
}
}
}```