简体   繁体   English

如何在 vue.js 中添加 laravel 刀片语法?

[英]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: 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);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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