TypeError: r.indexOf is not a function TypeError: r.indexOf is not a function

After checking some data, it was found that the data was passed from the back end to the front end, and the front end did not handle it well, so an error was reported

Problem: because I want to load a list El table, the required data format is as follows

// Required data format for el-table's :data
[{...} ,{...} ,... ,{...}]
// The format of the data returned by the backend, I returned it directly to :data, which is obviously not correct, it should wrap a []
{...}

Based on this, the way of processing data is not right

// For example, if you deconstruct a res object from the backend, you only need [res] or [res.xx] to solve the problem
// Instance:
getUserByName(name).then(res => {
	console(res) // you can look at the format of res in the background, what you really want, and then take it out by way of .xxx
	this.userList = [res.data]
})
// I'll go back to el-table here and put :data=userlist to fix it

Read More: