fieldListApi属性增加请求头headers设置。

master
vdpAdmin 2022-02-14 14:24:24 +08:00
parent 62bb84dc65
commit a409a7437b
1 changed files with 4 additions and 1 deletions

View File

@ -90,6 +90,7 @@
/* 后端字段列表API */ /* 后端字段列表API */
fieldListApi: { fieldListApi: {
type: Object, type: Object,
headers: Object, //
default: null, default: null,
}, },
@ -240,10 +241,12 @@
return return
} }
axios.get(this.fieldListApi.URL).then(res => { let headers = this.fieldListApi.headers || {}
axios.get(this.fieldListApi.URL, {'headers': headers}).then(res => {
let labelKey = this.fieldListApi.labelKey || 'label' let labelKey = this.fieldListApi.labelKey || 'label'
let nameKey = this.fieldListApi.nameKey || 'name' let nameKey = this.fieldListApi.nameKey || 'name'
this.fieldList.splice(0, this.fileList.length) //
res.data.forEach(fieldItem => { res.data.forEach(fieldItem => {
this.fieldList.push({ this.fieldList.push({
label: fieldItem[labelKey], label: fieldItem[labelKey],