0.2.2 • Published 4 years ago
nuxt-swaggerjsonapi v0.2.2
title: "Introduction" description: "The nuxt-swaggerjsonapi module for Nuxt" position: 1 category: "" menuTitle: "Introduction" features:
- Automatically add API to application
- Quickly copy API method and data to page, component, layout, vuex and Middleware
- Friendly @nuxtjs/axios integration
- Provide address generation swagger.json And Provide local swagger.json File path
Setup
Add nuxt-swaggerjsonapi dependency to your project
npm install nuxt-swaggerjsonapi
or
yarn add nuxt-swaggerjsonapi
Recommended use @nuxtjs/axios
yarn add @nuxtjs/axios
Then add it to the modules section in your nuxt.config.js
export default {
modules: ["@nuxtjs/axios", "nuxt-swaggerjsonapi"],
plugins: ["~plugins/api"],
};
Configure
const path = require("path");
export default {
modules: ["@nuxtjs/axios", "nuxt-swaggerjsonapi"],
plugins: ["~plugins/api"],
swaggerJsonApi: {
// Address generation and local generation
/*
** SourcePath: path.resolve(__dirname, "swagger.json"),
** OR
** FileUrl: "http://localhost:8080/swagger.json",
*/
SourcePath: path.resolve(__dirname, "swagger.json"),
OutputPath: path.resolve(__dirname, "./plugins/api/api.js"),
Model: "details",
},
};
- Sourcepath: Swagger.json route
- OutputPath: Api.js route
Development environment api.js And formal environment api.js The difference between
Model: "" (default)
// getUserInfo
Model: "details"
/*
** Interface name: getUserInfo
** Parameter structure:
** {"name":"AuthToken","in":"header","description":"Token info"}
** methods: The entire API call (Directly copy, paste, remove the notes can be used directly):
GetUserCloudAccount(){
let params = {
}
this.$api.Account.GetUserCloudAccount(params).then(res => {
})
},
** data(Vue use):
GetUserCloudAccountParams: {
}
*/
Author
LICENSE
0.2.1
4 years ago
0.1.2
4 years ago
0.2.0
4 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.9
4 years ago
0.1.4
4 years ago
0.2.2
4 years ago
0.1.3
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago
0.0.24
4 years ago
0.0.25
4 years ago
0.0.26
4 years ago
0.0.23
4 years ago
0.0.22
4 years ago
0.0.20
4 years ago
0.0.21
4 years ago
0.0.16
4 years ago
0.0.17
4 years ago
0.0.18
4 years ago
0.0.19
4 years ago
0.0.15
4 years ago
0.0.14
4 years ago
0.0.12
4 years ago
0.0.13
4 years ago
0.0.11
4 years ago
0.0.10
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago