[Vuejs]-Moustache variable does not expand in class or id tag

0👍

You need to do data binding between your data and html.

Vue handles it following way

Make use of key bindings provided by vue for ref check key binding

Your code will look as following

<script setup>
defineProps( {
  ids: {
    type: Number
  }
})
</script>
<script>
export default {
  name: "simple-component",
  nom: 1,
  data() {
    return {
      id: 1
    }
  }
}
</script>

<template>
  <div>{{ id }}</div>
  <div :id="ids" v-once :class="'Control-Template'+id"></div>
</template>

Check out sfc playground for working example.

Leave a comment