属性配置-标准体系

This commit is contained in:
zyn
2023-10-10 14:58:22 +08:00
parent 6cbe9dc6e4
commit f1a9b2f5a3
6 changed files with 332 additions and 10 deletions
+51 -1
View File
@@ -558,7 +558,27 @@ export default {
})
},
_postData (url, param = {}, config = {}) {
_postData (url, params, config = {}) {
// 参数包含this
let _this = config._this || false
// 参数包含loading
let loading = config.loading || false
if (_this && loading) {
_this[loading] = true
}
return new Promise((resolve, reject)=>{
_axios.post(api() + url + '?_t=' + new Date().getTime(), params).then(res => {
resolve(res.data)
}).catch(err => {
reject(err)
}).finally(()=>{
if (_this && loading) { _this[loading] = false }
})
})
},
_post (url, param = {}, config = {}) {
return new Promise((resolve,reject) => {
var _formData = formData(param)
// 参数包含this
@@ -585,6 +605,36 @@ export default {
})
},
_deleteData (url, params = {}) {
return new Promise((resolve, reject)=>{
_axios.delete(api() + url + '?_t=' + new Date().getTime(), { params }).then(res => {
resolve(res.data)
}).catch(err => {
reject(err)
})
})
},
_putData (url, params = {}, config = {}) {
// 参数包含this
let _this = config._this || false
// 参数包含loading
let loading = config.loading || false
if (_this && loading) {
_this[loading] = true
}
return new Promise((resolve, reject)=>{
_axios.put(api() + url + '?_t=' + new Date().getTime(), params).then(res => {
resolve(res.data)
}).catch(err => {
reject(err)
}).finally(()=>{
if (_this && loading) { _this[loading] = false }
})
})
},
_downloadFile (url, params = {}, method = 'get', fileName = '导出文件') {
_axios({
method,