【问题标题】:Vue - Interpolation inside attributesVue - 属性内插值
【发布时间】:2020-04-25 03:59:11
【问题描述】:

我有以下错误:

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】:

    您可以按如下方式使用模板字面量:

    :src="`/images/${this.phCode}/${this.galCode}/thumb/thumb_${this.fileName}`"
    

    【讨论】:

      猜你喜欢
      • 2019-01-30
      • 2021-01-24
      • 1970-01-01
      • 2020-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-29
      • 1970-01-01
      相关资源
      最近更新 更多