surface-plus
v1.1.0
Published
[surface-plus](https://doc.zsw.ink/)
Downloads
7
Readme
文档地址
安装
# 1.安装surface和element
npm install surface-plus
// element
npm install element-plus
# 2.在main.js中注册
import { createApp } from 'vue'
import App from './App.vue'
import 'element-plus/dist/index.css'
import Surface from 'surface-plus/dist/index.esm';
import ElementPlus from 'element-plus'
createApp(App)
.use(Surface)
.use(ElementPlus)
.mount('#app')
统一接口响应格式
// 0成功、大于0为错误
{
"code": 0,
"data": [],
"msg": "success"
}
如果需要修改自定义配置可以在surface注册时传入配置
app.use(Surface, {
responseKeys: { // 异步请求响应 key 别名
code: 'code',
data: 'data',
msg: 'msg',
},
responseSuccessCode: 0, // 请求成功`code`的值 其他值都为失败
})