简体   繁体   中英

how to add laravel blade syntax inside vue.js?

I started working on a small project using vue.js and laravel , and i would like to know how can i put blade syntax inside vue.js template code or inside axios for example:

 axios.post("{{ route('myRouteName')  }}", $('#add-related-contact'))

Thank you

You should first pass the route to your component using the component props, then you can use it.

Ex.

<your-component :route="{{ route('myRouteName') }}">
</your-component>
...
 methods: {
   ...
   MethodUsingAxios(){ 
     axios.post(this.route);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM