Skip to content

fix(dropdown): Add support for vue router links in dropdown items

What does this MR do?

Add support for vue router links in dropdowns

In order for dropdown items to provide Vue Router support, we must render a dropdown item when the attribute "to" is provided.

Why is this change needed?

<b-dropdown-item> supports Vue Router's to. With this change, gitlab-ui will also allow us to link to Vue Router pages using dropdown items.

In practice this means we should be able to do this:

<gl-new-dropdown-item :to="{ name: PANEL_NEW_PAGE }">
   New Panel
</gl-new-dropdown-item>

See: https://bootstrap-vue.org/docs/components/dropdown#comp-ref-b-dropdown-item

Use Case

Does this MR meet the acceptance criteria?

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidlines.
  • [-] If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • [-] If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • If the MR changes a component's API, integration MR(s) have been opened in the following projects to ensure that the @gitlab/ui package can be upgraded quickly after the changes are released:
  • Added the ~"component:*" label(s) if applicable.
Edited by Miguel Rincon

Merge request reports