question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Add supoort for <inertia-link> component

See original GitHub issue

Problem to solve

I’m using Inertia.js with Laravel after a lot of frustration with Nuxt. Inertia do it’s navigation magic with the <inertia-link> component. It’s something linke <nuxt-link>. It would be nice to have support for this on <v-btn>, <v-chip> just like we have for nuxt.

Proposed solution

It could be something as simple as: <v-btn inertia to="route">. The same deal going on with <v-btn nuxt to="route>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
garrensweetcommented, Feb 5, 2021

This really sounds like a deal breaker to me. With BootstrapVue there is a workaround (see bootstrap-vue/bootstrap-vue#5759) as there is a way to assign custom link component to it. Is there any similar workaround here?

Stumbled across this and wanted to an answer as well. I found that the inertia-link component has the as property which accepts any DOM element or vue component. Additionally, the props passed to the inertia-link component are passed to the rendered component implementation when using as so you’re able to leverage the standard Vuetify v-btn properties on it as well and it all works great.

<inertia-link as="v-btn" href="/" color="secondary" block small> Link </inertia-link>

5reactions
OrkhanAlikhanovcommented, Sep 30, 2021

In my case I was not using vue router in the project, so I registered the inertia-link globally as router-link.

Vue.component('router-link', {
  functional: true,
  render(h, context) {
    const data = { ...context.data }
    delete data.nativeOn
    const props = data.props as any || {}
    props.href = props.to /// v-btn passes `to` prop but inertia-link requires `href`, so we just copy it
    return h('inertia-link', data, context.children)
  },
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

InertiaJs Link Component - DEV Community ‍ ‍
In this Tutorial, we will create a Vue Component which will be responsible for the design and display of all the InertiaJs Links...
Read more >
Links - Inertia.js
To create links within an Inertia app you'll need to use the Inertia link component. This is a light wrapper around a standard...
Read more >
The Ultimate Guide to Inertia.js - Kinsta
A look at how Inertia.js makes constructing single-page applications a piece of cake, while solving other problems for developers.
Read more >
Inertia.js Support - IntelliJ IDEA & PhpStorm Plugin | Marketplace
Provides support in PhpStorm and IntelliJ IDEA Ultimate for Inertia.js. GitHub Issues: feature requests and bug reports.
Read more >
Laravel Inertia: Installation Tutorial and Tips & Tricks
This is done using the <Link> component. When a user clicks an 'inertia link,' Inertia intercepts it and makes an AJAX request to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found