属性配置-标准体系
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user