[Solved] Element-ui Error: [Vue warn]: Invalid prop: type check failed for prop “index”. Expected String with value “1”, got Number with value 1

Error screenshot:

 

wrong reason:

The index value type of the menu component in element-ui must be a string type. I bound the index property and assigned it to a num value type, so an error was reported.

<el- submenu
     :index ="index + 1" 
     :key ="index" 
     v - for ="(item, index) in menus"></el-submenu>

solution:

Just change the value of the :index attribute to a string type,

<el- submenu
     :index ="index + 1 +''" 
     :key ="index" 
     v - for ="(item, index) in menus"></el-submenu>

Perfect solution:

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *