ElementUI dynamically renders form data, and check boxes do not display selected items

problem description

question: elementUI dynamically renders form data, check boxes do not display selected items

scenario of the problem

first of all, there will be a form submission page that submits user information, and after the submission is successful, the data will be refreshed.

at present, the problem is that after the check box in the form is refreshed, the selected item does not show the selected status, in addition, it cannot be selected by a single click again, but all is selected;

Picture description

Picture description

related codes

returned field structure: course1: "[" Joint "," Aesthetics "]"

"
  • template Code
// 
this.resumeForm.course1 = res.data.course1;

solve

Dec.08,2021

if the course1: "[Joint", "Aesthetics"] "" code you intercepted is not copied incorrectly, it should be an unserialized string rather than an array.
the requested data assignment can be changed to the following code

this.resumeForm.course1 = JSON.parse(res.data.course1);
Menu