handle data attributes with webpack and vuejs handle data attributes with webpack and vuejs vue.js vue.js

handle data attributes with webpack and vuejs


Use the require() helper

Example:

<object :data="require(`../path/to/file-${if-you-need-to-pass-a-variable-here}.svg`)" type="image/svg+xml" >fallback</object>

<img :src="require(`../path/to/file-${if-you-need-to-pass-a-variable-here}.svg`)" alt="">