[Vuejs]-Webpack require, how to pass a string variable?

0👍

Maximum you could is a require with expression, with full variable it wont work. See docs here

<template>
    <img :src="require('@/assets/channels/'+test+'.png')" />
</template>

export default {
  data() {
    return {
      test: "email"
    };
  }
}

Leave a comment