1

I want to use radio buttons so each time I select one the form changes, I tried with simple html code but I would love to do it with Ant design vue. here's the code I have now i want to make it with antdv..

<input type="radio" v-model="z" value="x" > <span>Xx</span> 
<input type="radio" v-model="z" value="y" > <span>Yy/span>

<div v-if="z === 'x'"> /*some code here for form n1*/</div>
<div v-if="z === 'y'"> /*some code here for form n2*/</div>
data(){
return {
z:'x'}
 },
Cyrine
  • 87
  • 2
  • 9

1 Answers1

0

The code works, you may need to explain the issue you're encountering

Vue.createApp({
  data() {
    return {
      z: 'x'
    }
  },
}).mount("#app")
label{display:block;margin:0.5em;}
<script src="https://unpkg.com/vue@3.0.7/dist/vue.global.prod.js"></script>

<div id="app">
  <label><input type="radio" v-model="z" value="x" >Xx</label>
  <label><input type="radio" v-model="z" value="y" >Yy</label>
  <pre>{{ {z} }}</pre>
  <div v-if="z === 'x'"> /*some code here for form n1*/</div>
  <div v-if="z === 'y'"> /*some code here for form n2*/</div>
</div>
Daniel
  • 34,125
  • 17
  • 102
  • 150