[英]Pass vue.js parameters using route name to laravel
I fetch data using vue.js into my view, so I want to pass parameters via vue.js to this route name. 我使用vue.js提取数据到视图中,因此我想通过vue.js将参数传递给此路由名称。 Like this:
像这样:
<img :src="{{ route('getImage', image.path) }}" />
I've tried various approaches but without success: 我尝试了各种方法,但没有成功:
<img src="{{ route('getImage', :image.path) }}" />
<img src="{{ route('getImage', @{{ image.path }} ) }}" />
<img src="{{ route('getImage', '@{{ image.path }}' ) }}" />
The basic method that works 起作用的基本方法
<img :src="'/img/'+image.path" />
The controller: 控制器:
public function getImage($filename, $params){ }
I want to pass more than one parameter to this route. 我想向此路由传递多个参数。 Please any ideas.
请任何想法。
Update: The question is already posted here but without solutions: Link to a route with a parameter of Vue.js 更新:问题已经在此处发布,但没有解决方案: 链接到带有Vue.js参数的路由
似乎您正在尝试结合javascript和php,为什么不在image.path中创建完整路径?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.