1、 Problem description
It is required to display the data from the back end in the table. Because there is no joint debugging, the front end and the back end are developing their own, so I wrote pseudo data to fill in as needed. Table.js: 968 uncaught (in promise) typeerror: data.slice is not a function. As shown in the figure below:
2、 Solutions
After reading the error report, in table.js, there is something wrong with the use of the table component. Then there must be something wrong with the value. The following is my pseudo data:
I wondered if there was a problem with the data type, so I went to see the official API, as shown in the following figure:
But it’s an array. It’s OK
I have no choice but to search the Internet and recommend Bing (in the case that the company doesn’t let it over the wall) here. It’s easy to use and the first solution is to find every time. It’s not like a certain degree of flying, either advertising or advertising.
The answer is that the parameter inserted into the datasource is a JSON object when it is initialized, and the JSON object does not support the. Slice (0) method.
3、 Solutions
I use the table component as follows:
<Table
className="projecttable"
bordered
dataSource={publishList!=[]}
columns={columns}
loading={releaselistLoading}
pagination={pagination}
rowClassName={
(_,index)=>{
return index%2?"rowk":"rowt"
}
}
/>
There should be a problem in the datasource. The previously retrieved answer says that it can be written as null during initialization. So the code is rewritten as follows:
<Table
className="projecttable"
bordered
dataSource={publishList!=[]?publishList:null}
columns={columns}
loading={releaselistLoading}
pagination={pagination}
rowClassName={
(_,index)=>{
return index%2?"rowk":"rowt"
}
}
/>
That’s it.
The effect picture is as follows:
All right, record’s over!
Read More:
- Ie11 reports an error unhandled promise rejection typeerror: the object does not support
- Unhandled project rejection type error: webassembly instance
- Unhandled rejection Error: EACCES: permission denied
- Unhandled rejection Error: EACCES: permission denied, open ‘/Users
- TypeError: connection.connect is not a function
- [Solved] jQuery Error: Uncaught TypeError: this.attr is not a function
- Wechat applet error: unhandled project rejection type error: webassembly.instant
- Using webpack to report typeerror: this.getresolve is not a function
- TypeError: this.getOptions is not a function at Object.lessLoader
- Typeerror occurred during gitbook installation: cb.apply is not a function
- TypeError: this.getOptions is not a function
- JS error – typeerror: XXX is not a function
- Common error: uncaught typeerror: document.getElementsByClassName (…).addEventListener is not a function
- Webpack error module build failed: typeerror: fileSystem.statSync is not a function
- Syntax error: typeerror: this.getoptions is not a function an error is reported when the. SCSS file is imported globally
- [Solved] Error handling response: TypeError: self.processResponse is not a function
- Uncaught (in promise) TypeError: Object(…) is not a function
- Typeerror in gitbook init: cb.apply is not a function solution
- Python error prompt: typeerror: ‘builtin’_ function_ or_ method‘ object is not subscriptable
- Vue Error in v-on handler: “TypeError: path.indexOf is not a function“