[Vuejs]-Dynamic vue template using v-if

0👍

Is there a particular reason why you would want to use jQuery? For one your mounted function is only going to be executed once the component is mounted. It’s not like a watcher where you’re constantly monitoring a value. And besides what you’re trying to do could simply be achieved like this ..

<div id="app">
<input type='text' id='test' v-model="input">

<template v-if="input == 's'">
<div>
A
</div>
</template>
<template v-if="input == 't'">
<div>
B
</div>
</template>
</div>

And ..

new Vue({
  el: '#app',
  data: {
    input: ''
  }
});  

Leave a comment