Skip to content

'href' attribute is not set in anchors when I use :to property in 'b-btn' component to set route by name #1015

@nelson6e65

Description

@nelson6e65

I use the :to property with my route name, but still renders an <a> element with href="#".

Link still works; seems to handle a kind of onclic event. No problem.

But I expected href to be set to the exact route.

Router config:

const routes = [
  //...
  { path: '/auth/login', name: 'auth.login', component: require('./pages/auth/login.vue') },
  { path: '/auth/register', name: 'auth.register', component: require('./pages/auth/register.vue') },
  // ...
]

const router = new Router({
    routes,
    scrollBehavior,
    mode: 'history'
})

I use:

<b-btn variant="primary" :to="{ name: 'auth.register' }">Sign up</b-btn>

Renders to:

<a href="#" class="btn btn-primary" target="_self">Sign up</a>

It adds an event listener for click.

I expect:

<a href="/auth/login" class="btn btn-primary" target="_self">Sign up</a>

Versions

yarn list v0.27.5
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions