How to correctly add dynamic attribute names in a Vue template using Pug? I'm using the following template:
<template lang="pug">
button(id=`button__${buttontype}`)
slot(name="text")
</template>
<script>
export default {
name: "Button",
data() {
return {
buttontype: "primary"
},
},
mounted() {
console.log(this.test); // This shows the value as 'primary'
},
};
</script>
The HTML element being generated is <button id="button__undefined"></button>
The value of buttontype is coming as undefined in the id attribute for some reason.