{"id":13536215,"url":"https://github.com/lzxb/vue-methods-promise","last_synced_at":"2025-03-21T04:32:38.382Z","repository":{"id":112517845,"uuid":"82754353","full_name":"lzxb/vue-methods-promise","owner":"lzxb","description":"Let Vue methods support return Promise","archived":false,"fork":false,"pushed_at":"2017-03-29T14:11:33.000Z","size":51,"stargazers_count":34,"open_issues_count":0,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-12T08:48:33.517Z","etag":null,"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"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lzxb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-02-22T03:05:33.000Z","updated_at":"2023-11-07T12:44:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"f776e91e-c781-4f08-ac8a-7281d13e7c99","html_url":"https://github.com/lzxb/vue-methods-promise","commit_stats":{"total_commits":45,"total_committers":1,"mean_commits":45.0,"dds":0.0,"last_synced_commit":"6c95a5d0766c2d00877f87c08f77fb5bced7ae5c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzxb%2Fvue-methods-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzxb%2Fvue-methods-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzxb%2Fvue-methods-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzxb%2Fvue-methods-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lzxb","download_url":"https://codeload.github.com/lzxb/vue-methods-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811436,"owners_count":16884331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","ava","axios","es6","fetch","request","rollup","vue","vue-demo","vue-methods","vue-methods-promise","vue-plugin","vue-promise","vue2","vue2-demo","vuejs","vuejs2"],"created_at":"2024-08-01T09:00:35.975Z","updated_at":"2024-10-28T09:24:36.152Z","avatar_url":"https://github.com/lzxb.png","language":"JavaScript","funding_links":[],"categories":["实用库"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/lzxb/vue-methods-promise.svg?branch=master)](https://travis-ci.org/lzxb/vue-methods-promise)\n[![dependencies Status](https://david-dm.org/lzxb/vue-methods-promise/status.svg)](https://david-dm.org/lzxb/vue-methods-promise)\n[![devDependencies Status](https://david-dm.org/lzxb/vue-methods-promise/dev-status.svg)](https://david-dm.org/lzxb/vue-methods-promise?type=dev)\n[![Known Vulnerabilities](https://snyk.io/test/npm/vue-methods-promise/badge.svg)](https://snyk.io/test/npm/vue-methods-promise)\n[![npm](https://img.shields.io/npm/v/vue-methods-promise.svg?style=flat-square)](https://www.npmjs.com/package/vue-methods-promise) \n[![npm](https://img.shields.io/npm/dt/vue-methods-promise.svg?style=flat-square)](https://www.npmjs.com/package/vue-methods-promise)\n\n# vue-methods-promise\n```\nLet Vue methods support promise\n```\n\n### Usage\n```\nnpm install --save vue-methods-promise\n```\n```javascript\n// Installation\nimport Vue from 'vue'\nimport vueMethodsPromise from 'vue-methods-promise'\n\nVue.use(vueMethodsPromise, {\n  hookName: '$promise', // Component default hook name\n  promise: (mp) =\u003e { // Promise callback\n    mp\n      .then((function (res) {\n        console.log(res)\n      })\n      .catch(function (err) {\n        console.log(err.msg) // Test error\n      })\n  }\n})\n\n// Usage\nexport default {\n  mounted () {\n    this.test()\n  },\n  methods: { // All return Promise type, will be dealt with\n    test () {\n      return Promise.reject(new Error({ msg: 'Test error' }))\n    }\n  }\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flzxb%2Fvue-methods-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flzxb%2Fvue-methods-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flzxb%2Fvue-methods-promise/lists"}