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

New package - Nuxt Lighthouse Module

Implementing automated Lighthouse audits on each deploy of your Nuxt.js application.

New package - Storybook Directories

A simple module for generating your storybook story structure based on your directory structure.

Gitprefix - Automatically formatting commit messages

Git precommit hook for appending branch and emoji prefixes

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