Nuxt-link and router-link don’t create href attribute

Versions

  • nuxt: 2.12
  • node: 13.7

Reproduction

https://github.com/SergeiPleshkov/create-nuxt-app

Additional Details

Href attribute is not attached to ” tag during SSR if ‘href’ was passed as not defined prop.

Steps to reproduce

Serve reproduction repo, inspect the source code.

image

source code from devtools’ network tab
image

document ready
image

What is Expected?

Passing not defined dynamic prop to ” should not cause href loss in SSR mode.

What is actually happening?

Href attribute appears after browser render.

Author: Fantashit

1 thought on “Nuxt-link and router-link don’t create href attribute

  1. No, i expect the behavior of :href="undefined" and no href prop at all to be equal. So you can use this component

      <component
        :is="tag"
        :href="href"
        :target="target"
        :to="to">
      </component>

    either with props {tag: 'a', href: 'google.com', target: '_blank'} and with {tag: 'n-link', to: '/home'} and get href attribute already existing in page source code in both cases

Comments are closed.