Relative Content

Tag Archive for javascripthtmlvue.jsvuejs2nuxt.js

Adding attribute to HTML elements to whole code

I’m using Nuxt 2 in my project with Storyblok datasources as translations and e.g. I’ve:
<span v-text="$t('labels.cartSell')" /> and I need to add something like data-translation="labels.cartSell" to that span. The problem is I’ve more than 600 $t uses in my code. Is there any possibility to add attribute automatically to every element in my code which contain $t?

Adding attribute to HTML elements to whole code

I’m using Nuxt 2 in my project with Storyblok datasources as translations and e.g. I’ve:
<span v-text="$t('labels.cartSell')" /> and I need to add something like data-translation="labels.cartSell" to that span. The problem is I’ve more than 600 $t uses in my code. Is there any possibility to add attribute automatically to every element in my code which contain $t?