我怎样才能在 laravel blade 的图像 src 中使用 vue 变量?
How can I use vue variable inside laravel blade's image src?
我正在尝试在 blade 和图像 src 属性中使用 vue 变量,但 vue 给出了模板编译错误。
我想做什么
<img src="uploads/@{{authUser.profilePic}}"/>
我可以将其作为纯模板分离,但 vue 模板加载速度比 blade 文件慢一点。
如有任何帮助,我们将不胜感激。
属性内的插值在 Vue 2 上不可用。您可以使用 v-bind:src
或快捷方式 :src
将 Javascript 表达式绑定到 src
.
<img :src="'uploads/' + authUser.profilePic"/>
javascript 表达式是字符串连接:
'uploads/' + authUser.profilePic
我正在尝试在 blade 和图像 src 属性中使用 vue 变量,但 vue 给出了模板编译错误。
我想做什么
<img src="uploads/@{{authUser.profilePic}}"/>
我可以将其作为纯模板分离,但 vue 模板加载速度比 blade 文件慢一点。
如有任何帮助,我们将不胜感激。
属性内的插值在 Vue 2 上不可用。您可以使用 v-bind:src
或快捷方式 :src
将 Javascript 表达式绑定到 src
.
<img :src="'uploads/' + authUser.profilePic"/>
javascript 表达式是字符串连接:
'uploads/' + authUser.profilePic