Iview Error: [Vue warn]: Error in render: “TypeError: ctx.injections.tableRoot.$scopedSlots[ctx.props.column.slot] is not a function”

The same one is found on the Internet. It is said that columns defines n slots, but n slots are not used in HTML. Although this is also one of the reasons, it is not my reason. Finally, I found that the reason for my problem is:

Two < are defined in the HTML template; Table>, Table1 has a slot and table2 does not. They are packaged in two different < template> Which is displayed through the V-IF control?Table1 is initially displayed, but table2 is displayed when the switching condition is triggered, but an error will be reported when switching back to table1. The solution is to give two <Table> Add the key attribute,

The essential reason is that Vue reuses the table component (the first one) because the key attribute is not added to the table. When switching to table2, there is no error because the columns of table2 do not define a slot, but when switching back to the first table1, an error will be reported.

Similar Posts: