Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Nov 5, 2021. It is now read-only.
/vue-laroutePublic archive

Wrapper for injecting laravel routes into your vue application

License

NotificationsYou must be signed in to change notification settings

samturrell/vue-laroute

Repository files navigation

npmvue2

Inject Laravel routes into your Vue application viaaaronlord/laroute. I actually recommend the alternative and more slim-lined version of this package fromAXN-Informatique/laravel-laroute.

DEMO

Using this plugin

Adding vue-laroute to your application is as simple as any other plugin:

importVuefrom'vue';importVueLaroutefrom'vue-laroute';importroutesfrom'../path/to/laroute.js';Vue.use(VueLaroute,{  routes,accessor:'$routes',// Optional: the global variable for accessing the router});newVue({el:'#app',});

You can now access your global accessor ($routes by default) in any component viathis.$routes, for example:

<template><div><h1>You can access it in your template</h1><nav><ul><li><a :href="$routes.route('home')">Home</a></li><li><a :href="$routes.route('products')">Home</a><ul><li><a :href="$routes.route('products.show', { id: 1 })">Product1</a>            </li><li><a :href="$routes.route('products.show', { id: 123 })">Product123</a>            </li></ul></li></ul>    </nav><button @click.prevent="purchaseProduct(123)">Purchase product</button>  </div></template><script>  export default{methods:{purchaseProduct(id){this.$http.post(this.$routes.route('products.purchase',{id:id})).then((response)=>{// Handler});},},}</script>

📜 Changelog

Details changes for each release are documented in theCHANGELOG.md.

❗ Issues

Please make sure to read theIssue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.

💪 Contribution

Please make sure to read theContributing Guide before making a pull request.

©️ License

MIT

About

Wrapper for injecting laravel routes into your vue application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp