Static GitHub Issues

[1975] ES6 template string build error

prev: 如何设置追踪推荐人代码?写在前端middleware或者nuxtServerInit都报错
next: Trouble accessing plugins via 'context.app' while in async data
export default {
  name: 'app',
  computed: {
    item () {
      return this.serverData.dealInfo
    }
  },
  data () {
    return {
      CDN_IMG_HOST: '//cdnimg.ydmap.com.cn',
      serverData: {
        dealInfo: {}
      }
    }
  }
}

This code not work:

<img class="item-img" :src="`${((item.commonSales || {}).picUrl || [])[1] || `${CDN_IMG_HOST}/commonsales/0/`}58X58.gif`">

Picture url is wrong:

/$%20%7B%20%20%20%20%20%20%20%20%20%20CDN_IMG_HOST%20%20%20%20%20%20%20%20%7D%20%20%20%20%20%20%20%20/commonsales/%20%20%20%20%20%20%20%200%20/%2058X58.gif

This code work fine:

<img class="item-img" :src="`${(item.commonSales.picUrl || [])[1] || `${CDN_IMG_HOST}/commonsales/0/`}58X58.gif`">

vue-cli new project created with https://github.com/vuejs-templates/webpack are work fine in both cases.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1756">#c1756</a>)</em></sub></div>