admin管理员组文章数量:1180476
Can someone help me with using the img
tag with vue.js?
Per the vue.js documentation, I tried:
<img v-bind:src={{ imgURL }}> //prints a null image
Here is my jsfiddle
Can someone help?
Can someone help me with using the img
tag with vue.js?
Per the vue.js documentation, I tried:
<img v-bind:src={{ imgURL }}> //prints a null image
Here is my jsfiddle
Can someone help?
Share Improve this question edited Dec 27, 2016 at 4:36 Saurabh 73.6k43 gold badges190 silver badges251 bronze badges asked Dec 27, 2016 at 4:16 Trung TranTrung Tran 13.7k48 gold badges124 silver badges208 bronze badges 3- 2 github.com/vuejs/Discussion/issues/202#issuecomment-207979862 – Andy Ray Commented Dec 27, 2016 at 4:22
- Does my answer works? – Jonathan Dion Commented Jun 12, 2017 at 15:04
- 2 v-bind:src="imgURL" – Vivick Commented Jul 24, 2017 at 23:25
4 Answers
Reset to default 21You need to remove the double bracket:
<img :src=imgURL>
You bind it with shorthand syntax, so we don't need 'v-bind' or '{{}}' braces, its beauty of VUE JS, ':' is used to bind.
Try this
<img v-bind:src=imgURL>
Above answers are both right but it doesn't really explains why the OP's making a mistake.
When you are using double brackets you are telling vue to do v-bind: so when you write v-bind and also use double brackets then you are double calling the same thus generating a mistaken behavior.
Short words: either use v-bind or double brackets {{ }}
Maybe you try to print an image from image binary code,
<img v-bind:src="'data:image/Bmp;base64,' + obj1.Obj2.propImage" />
本文标签: javascriptimg url with vuejsStack Overflow
版权声明:本文标题:javascript - img url with vue.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738106631a2064386.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论