[Vuejs]-How to check radio button in Vue

0๐Ÿ‘

<template>
  <div id="app">
    <label>
      <input type="radio" @click="handleFirstRadioClick" />
      test1
    </label>

    <label class="radio-2">
      <input type="radio" :checked="secondRadioValue" />
      test2
    </label>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      secondRadioValue: false,
    };
  },
  methods: {
    handleFirstRadioClick() {
      return (this.secondRadioValue = true);
    },
  },
};
</script>

Full example:
https://codesandbox.io/s/amazing-dust-hen6w?file=/src/App.vue

Leave a comment