1.0.7 • Published 5 years ago

@zq741235/vue-cli-plugin-axios v1.0.7

Weekly downloads
279
License
ISC
Repository
github
Last release
5 years ago

@zq741235/vue-cli-plugin-axios

安装

vue add @zq741235/axios

使用

1.添加自己的api到模块里(如:src/api/module)

// src/api/module/xx
export const GET_XX = '/api/XX'

2.在src/api/index中全量导出

export * from './module/xx'

3.页面导入

import {GET_XX} from '@/api' // @为src

4.页面引用

this.$_get(GET_xx).then(res=>{})
this.$_get(GET_xx,{paramsA:11,paramsB:22}).then(res=>{})
this.$_post(GET_xx).then(res=>{})
this.$_post(GET_xx,{paramsA:11,paramsB:22}).then(res=>{})
this.$_post(GET_xx,{paramsA:11,paramsB:22},{
    // 第三个可以传axios配置的参数
}).then(res=>{})

其他

配合zq741235/router可直接查看示例

http://localhost:8080/axios

vue-cli-plugin-router

vue add @zq741235/router

一键安装基础模版

vue create --preset zq741235/vue-cli-plugins my-project
1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago