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

DropdownItem tag="nuxt-link" does not work #502

Closed
thedomeffm opened this issue Mar 28, 2023 · 3 comments
Closed

DropdownItem tag="nuxt-link" does not work #502

thedomeffm opened this issue Mar 28, 2023 · 3 comments
Assignees
Labels
enhancement Improvements to existing features and functionality

Comments

@thedomeffm
Copy link

thedomeffm commented Mar 28, 2023

Overview of the problem

Oruga version: [0.5.10]
Vuejs version: [3]
OS/Browser: Chrome

Description

The tag="router-link" tag does work, but tag="nuxt-link" does not.

  <o-dropdown v-if="row.isPaid"
              position="bottom-left"
              aria-role="list">
      <template #trigger="{ active }">
          <button class="button is-ghost has-text-black">
              <o-icon icon="ellipsis-vertical" />
          </button>
      </template>

      <o-dropdown-item tag="router-link"
                       :to="localePath({ name: 'e-id', params: { id: row.code } })"
                       aria-role="listitem">
          <o-icon icon="up-right-from-square" />
          <span>{{ t('table.action.preview') }}</span>
      </o-dropdown-item>

      <o-dropdown-item tag="nuxt-link"
                       :to="localePath({ name: 'e-id', params: { id: row.code } })"
                       aria-role="listitem">
          <o-icon icon="up-right-from-square" />
          <span>{{ t('table.action.preview') }}</span>
      </o-dropdown-item>
  </o-dropdown>

Will result in the following rendered HTML:

image

Expected behavior

The nuxt-link as tag should work like the router-link. (nuxt does understand my current workaround that I use router-link).

Actual behavior

See screenshot - the first link (with tag="router-link") gets rendered correct.
The second drop-down-item (with tag="nuxt-link") gets rendered as.... a <nuxt-link> and not a <a>.

@thedomeffm
Copy link
Author

thedomeffm commented Mar 28, 2023

@jtommy we wrote in Discord about the problem already.
You send me the link => nuxt/nuxt#13659

So it seems like it is the "cOrReCt" behavior of nuxt3 :/


This does work => renders correctly,

<o-dropdown-item :tag="defineNuxtLink({})"
                 :to="localePath({ name: 'e-id', params: { id: row.code } })"
                 aria-role="listitem">
    <o-icon icon="up-right-from-square" />
    <span>{{ t('table.action.preview') }}</span>
</o-dropdown-item>

But the "tag" prop should be a String and some errors are thrown.
[Vue warn]: Invalid prop: type check failed for prop "tag". Expected String with value "[object Object]", got Object at <ODropdownItem tag= {name: 'NuxtLink' ...

@jtommy jtommy self-assigned this Mar 29, 2023
@jtommy jtommy added the enhancement Improvements to existing features and functionality label Mar 29, 2023
@andrzejkupczyk
Copy link
Contributor

Thank you for bringing this up. I would like to add that this issue also affects the OButton component.

@fahdaddi
Copy link
Contributor

fahdaddi commented Oct 16, 2023

@jtommy, still having the same issue when using o-button with tag="nuxt-link"... I'm using Nuxt 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features and functionality
Projects
None yet
Development

No branches or pull requests

4 participants