Using laroute and Vue together


Following on from my previous blog post on laroute, I went ahead and created a helpful plugin to ease the integration with projects utilising the Vue.js framework.

Introducing vue-laroute. A simple package with a simple purpose. Simply provide your routes, and access them from within your Vue components and templates using the accessor you provide. By default this is $routes but can be changed to avoid conflicts.

From there you have all the routes in your app at your fingertips. For example:

A link:

<p>Let's go <a :href="$routes.route('home')">Home</a></p>

An API request:

axis.get(this.$routes.route('products.show', { id: 1337 }))
    .then((response) => { /* Got Product */ });

To pull in the plugin, simply yarn add vue-laroute and follow the instructions in the documentation.

If you like this plugin, please do star it on GitHub and share.

Related Posts

Automated Pull Request Checks on Github

Using Probot to create automated checks on Github Pull Requests

Netsells 💙 Vue (+ Vue.js London)

Why we at Netsells love the Vue.js framework and where you can find us later this week

Maximising Productivity with Slack

Staying productive with your favourite workplace chat app

Stop with the unhelpful loading spinners

Give some context to your users with some helpful loading text

Responsive Blocks and Vertical Alignment

How to create responsive cross-browser blocks with vertically aligned content

Development Goals for 2018

New Year Promise.resolve()

Progressively Infiltrating Google

Attending the Google Academy for a course on Progressive Web Apps

Laravel Certification Prelude

The Laravel Certification exam is here and I'm taking it.

Helpful Laravel Valet aliases

Valet up, up, down, down, left, right, left, right, B, A.

Serving static content in Laravel Valet

Check out my custom valet driver for prototyping outside of a framework.