Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate external links #43

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

heberalmeida
Copy link

I needed one or more external links, and I had to include them in your great code

@johndatserakis
Copy link
Owner

Thank you very much for the PR, I do appreciate the effort.

In this case, I do not feel this update is needed, as you can launch an external link using the code mentioned in this comment.

Please see below, I believe this will achieve what you're looking for.

<template>
  <vue-navigation-bar
    :options="navbarOptions" 
    @vnb-item-clicked="vnbItemClicked"
  />
</template>

<script>
...
data () {
  return {
    navbarOptions: {
      ....,
      menuOptionsLeft: [
        {
          type: "button",
          text: "External Link",
          isLinkAction: true
        }
      ]
    }
  }
},
methods: {
    vnbItemClicked(text) {
      if (text === "External Link") {
		window.open("put the link here", '_blank');
      }
    }
  }
</script>

@heberalmeida
Copy link
Author

Hello, thank you very much for responding, I understand, but sometimes I want to open the link in a tab without having to use javascript, in my case I had to do this, because there were people who opened several links to copy certain things, and using javascript forced them to person clicking.
That's why I carried out this implementation

@johndatserakis
Copy link
Owner

The issue is that it's difficult to please all use cases. The intention of this library is to satisfy the main use case as best as possible. Beyond that, I recommend forking the library.

For example, even as a result of this PR, users cannot use this feature when isUsingVueRouter is enabled. That is confusing. We already have a difficult story around that, and this further complicates that.

Additionally, the props added in this PR do not mesh with the current way isUsingVueRouter works. When isUsingVueRouter = false, any of the links may possibly be external, and thus isUsingLink becomes confusing.

I think the best way to move forward in you case is to use the code I shared above, as it will accomplish what you need, and can be used both with and without the vue-router context, and doesn't need any changes to vue-navigation-bar.

If that doesn't work, perhaps you can fork vue-navigation-bar.

Again, thank you for the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants