在更改错误时,预期的功能但得到了表达
on change error, function expected but got expression
试图理解为什么会出现此错误...
Expected an assignment or function call and instead saw an expression
这是我的代码:
{ label: "Responsable devis *",
width: 6,
select: {
disabled: isDisabled,
border: !newBusiness.responsableOfInvoice
? "borderwarning"
: "border",
placeholder: "Responsable devis",
defaultValue: newBusiness.responsableOfInvoice,
items: Object.keys(invoiceResponsableCorres),
value:
invoiceResponsableReverseCorres[newBusiness.responsableOfInvoice],
onChange: (e) => {
setNewBusiness((vals) => ({
...vals,
responsableOfInvoice:
INVOICE_RESPONSABLE[invoiceResponsableReverseCorres[e]],
}));
e: invoiceResponsableReverseCorres[INVOICE_RESPONSABLE.SITE];
},
},
},
所以我知道这部分是错误的:
e: invoiceResponsableReverseCorres[INVOICE_RESPONSABLE.SITE];
但是我尝试了不同的方法来解决这个问题,但没有任何效果。
谁能解释我做错了什么?
您提供的对象无效,这里是有效对象:
{
label: {
label: "Responsable devis *",
width: 6,
select: {
disabled: isDisabled,
border: !newBusiness.responsableOfInvoice ? "borderwarning" : "border",
placeholder: "Responsable devis",
defaultValue: newBusiness.responsableOfInvoice,
items: Object.keys(invoiceResponsableCorres),
value: invoiceResponsableReverseCorres[newBusiness.responsableOfInvoice],
onChange: (e) => {
setNewBusiness((vals) => ({
...vals,
responsableOfInvoice: INVOICE_RESPONSABLE[invoiceResponsableReverseCorres[e]],
}))
},
e: ''
}
}
}
试图理解为什么会出现此错误...
Expected an assignment or function call and instead saw an expression
这是我的代码:
{ label: "Responsable devis *",
width: 6,
select: {
disabled: isDisabled,
border: !newBusiness.responsableOfInvoice
? "borderwarning"
: "border",
placeholder: "Responsable devis",
defaultValue: newBusiness.responsableOfInvoice,
items: Object.keys(invoiceResponsableCorres),
value:
invoiceResponsableReverseCorres[newBusiness.responsableOfInvoice],
onChange: (e) => {
setNewBusiness((vals) => ({
...vals,
responsableOfInvoice:
INVOICE_RESPONSABLE[invoiceResponsableReverseCorres[e]],
}));
e: invoiceResponsableReverseCorres[INVOICE_RESPONSABLE.SITE];
},
},
},
所以我知道这部分是错误的:
e: invoiceResponsableReverseCorres[INVOICE_RESPONSABLE.SITE];
但是我尝试了不同的方法来解决这个问题,但没有任何效果。
谁能解释我做错了什么?
您提供的对象无效,这里是有效对象:
{
label: {
label: "Responsable devis *",
width: 6,
select: {
disabled: isDisabled,
border: !newBusiness.responsableOfInvoice ? "borderwarning" : "border",
placeholder: "Responsable devis",
defaultValue: newBusiness.responsableOfInvoice,
items: Object.keys(invoiceResponsableCorres),
value: invoiceResponsableReverseCorres[newBusiness.responsableOfInvoice],
onChange: (e) => {
setNewBusiness((vals) => ({
...vals,
responsableOfInvoice: INVOICE_RESPONSABLE[invoiceResponsableReverseCorres[e]],
}))
},
e: ''
}
}
}