Vue2 + el-menu Implementation of Route jump and the current item Setting Method Instance, vue2el-menu

Source: Internet
Author: User

Vue2 + el-menu Implementation of Route jump and the current item Setting Method Instance, vue2el-menu

What is Vue. js?

Vue. js (pronunciation/vju example/, similar to view) is a progressive framework for building user interfaces. Different from other heavyweight frameworks, Vue adopts a bottom-up and incremental development design. The core Vue Library only focuses on the view layer. It is not only easy to use, but also easy to integrate with third-party libraries or existing projects. On the other hand, when used in conjunction with a single file component and a Library Supported by the Vue ecosystem, Vue can also provide drivers for complex single-page applications.

Now, this article describes how to implement route jump and set the current item through vue2 + el-menu. The specific content is as follows:

<Span style = "font-size: 24px;" deep = "5"> <el-menu router: default-active = "$ route. path "class =" el-menu-vertical-demo "@ open =" handleOpen "@ close =" handleClose "theme =" dark "> <el-submenu index =" 1"> <template slot = "title"> <I class = "el-icon-location"> </I> <span> User Information </span> </template> <el -menu-item-group> <el-menu-item index = "/user/account"> account information </el-menu-item> <el-menu-item index = "/user/password"> Change password </el-menu-item> </el-submenu> <el-submenu index = "2"> <template slot = "title"> <I class = "el-icon-location"> </I> <span> Company Information </span> </template> <el-menu-item-group> <el-menu-item index = "/company/userManager"> User management </el-menu-item> <el-menu-item index = "/company/editUser"> Add /edit user </el-menu-item> </el-menu-item-group> </el-submenu> </el-menu> </span>

1. to achieve route jump, you must first add the router attribute on the el-menu label, then, you only need to set the url for the index attribute in each el-menu-item label to click el-menu-item to achieve route jump.

2. Bind the current item to the el-menu tab:default-active="$route.path"Note that the attribute is bound. Do not forget to add ":". When $ route. path is equal to the index attribute value in the el-menu-item label, this item is the current item.

Summary

The above section describes the vue2 + el-menu method used to implement route jump and set the current item. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.