这是一个创建于 789 天前的主题,其中的信息可能已经有所发展或是发生改变。
const createTerm = () => {
form
.validateFields()
.then((value) => {
console.log(value.aliases);
let api =
termInfo && Object.hasOwn(termInfo, "id")
? glossaryApi.updateGlossary({ ...value, id: termInfo?.id })
: glossaryApi.createGlossary({ ...value, domainId: 1000 });
api
.then((res) => {
setTermReturnId(res?.data);
message.success("术语创建成功");
})
.catch(() => {
message.error("术语创建失败");
});
})
};
console.log(value.aliases);打印结果是
['近似值 1', '近似值 2']
接口调用时,参数是
aliases: {0: "近似值 1", 1: "近似值 2"}
这就很奇怪
3 条回复 • 2022-08-02 10:45:53 +08:00
|
|
1
maichael 2022-08-01 17:44:14 +08:00
请求体里面显示的也是 aliases: {0: "近似值 1", 1: "近似值 2"} ?
|
|
|
3
jifengg 2022-08-02 10:45:53 +08:00
{ ...value, domainId: 1000 }
兄弟,你解构后又重构一个 object ,可不就这样了么
|