有一张图片的src属性值是由两个字条串拼接而成的,起先我写成这要:
<img src="{{imgPreUrl}}img/logo.png">
没想到不对,Mustache 语法不能作用在 HTML 特性上,遇到这种情况应该使用 v-bind 指令,应写成:
<img v-bind:src="imgPreUrl + 'img/logo.png'">
或者简写与:
<img :src="imgPreUrl + 'img/logo.png'">
参考资料:

有一张图片的src属性值是由两个字条串拼接而成的,起先我写成这要:
<img src="{{imgPreUrl}}img/logo.png">
没想到不对,Mustache 语法不能作用在 HTML 特性上,遇到这种情况应该使用 v-bind 指令,应写成:
<img v-bind:src="imgPreUrl + 'img/logo.png'">
或者简写与:
<img :src="imgPreUrl + 'img/logo.png'">
参考资料: