We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如标题
Google 关键字 vue dynamic bind image src,第一个 Stack Overflow 的链接中就有答案:Vue.js dynamic images not working。
vue dynamic bind image src
具体代码很简单,用下面的方法来动态生成图片的地址,关键是返回的图片地址要用 require() 给包起来。
require()
topThree(index) { return require(`@/assets/game1/img/rank/rank-${index}.png`) }
然后在 Vue 的 template 中动态绑定到 img 元素的 src 属性上即可:
template
img
src
<img :src="topThree(index + 1)">
The text was updated successfully, but these errors were encountered:
No branches or pull requests
需求描述
如标题
解决过程
Google 关键字
vue dynamic bind image src
,第一个 Stack Overflow 的链接中就有答案:Vue.js dynamic images not working。具体代码很简单,用下面的方法来动态生成图片的地址,关键是返回的图片地址要用
require()
给包起来。然后在 Vue 的
template
中动态绑定到img
元素的src
属性上即可:The text was updated successfully, but these errors were encountered: