Vue - 属性内插值

问题描述 投票:0回答:1

我有以下错误。

src="/images/{{ this.phCode }}/{{ this.galCode }}/thumb/thumb_{{ this.fileName }}": 
Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. 
For example, instead of <div id="{{ val }}">, use <div :id="val">.

虽然这个例子非常清楚,但我很难理解如何在我的情况下做到这一点,因为我的属性中有多个变量。

vue.js attributes interpolation
1个回答
4
投票

您可以使用模板字元,如下所示。

:src="`/images/${this.phCode}/${this.galCode}/thumb/thumb_${this.fileName}`"
© www.soinside.com 2019 - 2024. All rights reserved.