fieldListApi属性增加请求头headers设置。
parent
62bb84dc65
commit
a409a7437b
|
@ -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],
|
||||||
|
|
Loading…
Reference in New Issue