我的天哪,卡了好久。結果是需要序列化:
序列化的方法:
參考:
https://www.cnblogs.com/fengff/p/8073967.html
什麼是序列化,爲什麼要序列化。
參考:
https://blog.csdn.net/qq_38419433/article/details/79740643
js怎樣把對象,裝在數組裏呢?提交後,怎麼變成object了?
有很多條這樣的數據格式:
{topicId:16,answer:Array(0),usePrompt:false}
我們後端需要我傳數組:
上圖的數據有length,所以應該是數組吧?
爲什麼傳給後端。提交的時候,就變成object了?
解決辦法是:JSON.stringify(this.ruleForm.allAnswers)
結果:成功!