mb-list mb-form mb-xxx等 统一请求方法 列表(post) 保存(post) 删除(delete) 详情(get) 等

This commit is contained in:
吕金泽
2022-03-08 00:56:23 +08:00
parent 0f4095a564
commit 3114b2c205
58 changed files with 1017 additions and 351 deletions
+5 -1
View File
@@ -38,7 +38,7 @@ common.handleDelete = (options) => {
}).then(() => {
request({
url: url,
method: 'post',
method: 'delete',
params: {
id: id
}
@@ -167,4 +167,8 @@ common.loadConfig = async() => {
})
}
common.setDefaultValue = (obj, attr, value) => {
obj[attr] = obj[attr] === undefined ? value : obj[attr]
}
export default common
@@ -27,7 +27,7 @@ function appComponent(app, item){
}
const install = (app) => {
app.config.globalProperties.$get('/component/list', { size: 999999 }).then((res) => {
app.config.globalProperties.$post('/component/list', { size: 999999 }).then((res) => {
res.data.list.forEach(it => {
appComponent(app, it)
})
+1 -1
View File
@@ -11,4 +11,4 @@ export default {
filePrefix: '',
visitedViews: reactive([]),
tabValue: ref('')
}
}
@@ -1,5 +1,7 @@
import * as PlusIcons from '@element-plus/icons-vue'
import VueUeditorWrap from 'vue-ueditor-wrap'
import Treeselect from 'vue3-treeselect'
import 'vue3-treeselect/dist/vue3-treeselect.css'
import request from './request'
import global from './global'
import common from './common'
@@ -19,6 +21,7 @@ const install = (app) => {
}
})
app.config.globalProperties.$get = (url, data) => request({ url, params: data })
app.config.globalProperties.$delete = (url, data) => request({ url, method: 'delete', params: data })
app.config.globalProperties.$global = global
app.config.globalProperties.$common = common
app.config.globalProperties.$treeTable = treeTable
@@ -26,5 +29,6 @@ const install = (app) => {
app.component(`El${key}`, PlusIcons[key])
}
app.use(VueUeditorWrap)
app.component('treeselect', Treeselect)
}
export default install