回答編集履歴
2
追記
    
        answer	
    CHANGED
    
    | @@ -120,9 +120,8 @@ | |
| 120 120 | 
             
                  this.radioValue = e.target.value;
         | 
| 121 121 | 
             
                  if (this.checkValue) {
         | 
| 122 122 | 
             
                    this.message = "変更できません";
         | 
| 123 | 
            -
                    const vm = this;
         | 
| 124 123 | 
             
                    this.$nextTick(function() {
         | 
| 125 | 
            -
                       | 
| 124 | 
            +
                      this.radioValue = "one";
         | 
| 126 125 | 
             
                    });
         | 
| 127 126 | 
             
                  }
         | 
| 128 127 | 
             
                }
         | 
| @@ -139,4 +138,24 @@ | |
| 139 138 | 
             
              }
         | 
| 140 139 | 
             
            };
         | 
| 141 140 | 
             
            </script>
         | 
| 141 | 
            +
            ```
         | 
| 142 | 
            +
             | 
| 143 | 
            +
            **追記 (2020/05/17)**
         | 
| 144 | 
            +
             | 
| 145 | 
            +
            上記はasync/awaitで下記のように書き直すことができます。
         | 
| 146 | 
            +
             | 
| 147 | 
            +
            ```
         | 
| 148 | 
            +
            methods: {
         | 
| 149 | 
            +
              updatedRadio: async function(e) {
         | 
| 150 | 
            +
                this.radioValue = e.target.value;
         | 
| 151 | 
            +
             | 
| 152 | 
            +
                // DOM更新の完了を待つ
         | 
| 153 | 
            +
                await this.$nextTick();
         | 
| 154 | 
            +
             | 
| 155 | 
            +
                if (this.checkValue) {
         | 
| 156 | 
            +
                  this.message = "変更できません";
         | 
| 157 | 
            +
                  this.radioValue = "one";
         | 
| 158 | 
            +
                }
         | 
| 159 | 
            +
              }
         | 
| 160 | 
            +
            },
         | 
| 142 161 | 
             
            ```
         | 
1
修正
    
        answer	
    CHANGED
    
    | @@ -67,4 +67,76 @@ | |
| 67 67 | 
             
              }
         | 
| 68 68 | 
             
            };
         | 
| 69 69 | 
             
            </script>
         | 
| 70 | 
            +
            ```
         | 
| 71 | 
            +
             | 
| 72 | 
            +
            **修正**
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            以下のように修正しました。これでチェックボックスがonのときは1番目のラジオボタンにチェックが強制的に付くようになります。
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            ```
         | 
| 77 | 
            +
            <input type="checkbox" v-model="checkValue" />
         | 
| 78 | 
            +
            <br />
         | 
| 79 | 
            +
            <input
         | 
| 80 | 
            +
              type="radio"
         | 
| 81 | 
            +
              id="one"
         | 
| 82 | 
            +
              value="one"
         | 
| 83 | 
            +
              :checked="radioValue === 'one'"
         | 
| 84 | 
            +
              @change="updatedRadio"
         | 
| 85 | 
            +
            />
         | 
| 86 | 
            +
            <label for="one">One</label>
         | 
| 87 | 
            +
            <br />
         | 
| 88 | 
            +
            <input
         | 
| 89 | 
            +
              type="radio"
         | 
| 90 | 
            +
              id="two"
         | 
| 91 | 
            +
              value="two"
         | 
| 92 | 
            +
              :checked="radioValue === 'two'"
         | 
| 93 | 
            +
              @change="updatedRadio"
         | 
| 94 | 
            +
            />
         | 
| 95 | 
            +
            <label for="two">Two</label>
         | 
| 96 | 
            +
            <br />
         | 
| 97 | 
            +
            <input
         | 
| 98 | 
            +
              type="radio"
         | 
| 99 | 
            +
              id="three"
         | 
| 100 | 
            +
              value="three"
         | 
| 101 | 
            +
              :checked="radioValue === 'three'"
         | 
| 102 | 
            +
              @change="updatedRadio"
         | 
| 103 | 
            +
            />
         | 
| 104 | 
            +
            <label for="three">three</label>
         | 
| 105 | 
            +
            <div>{{ message }}</div>
         | 
| 106 | 
            +
            ```
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            ```
         | 
| 109 | 
            +
            <script>
         | 
| 110 | 
            +
            export default {
         | 
| 111 | 
            +
              data() {
         | 
| 112 | 
            +
                return {
         | 
| 113 | 
            +
                  checkValue: false,
         | 
| 114 | 
            +
                  radioValue: null,
         | 
| 115 | 
            +
                  message: null
         | 
| 116 | 
            +
                };
         | 
| 117 | 
            +
              },
         | 
| 118 | 
            +
              methods: {
         | 
| 119 | 
            +
                updatedRadio(e) {
         | 
| 120 | 
            +
                  this.radioValue = e.target.value;
         | 
| 121 | 
            +
                  if (this.checkValue) {
         | 
| 122 | 
            +
                    this.message = "変更できません";
         | 
| 123 | 
            +
                    const vm = this;
         | 
| 124 | 
            +
                    this.$nextTick(function() {
         | 
| 125 | 
            +
                      vm.radioValue = "one";
         | 
| 126 | 
            +
                    });
         | 
| 127 | 
            +
                  }
         | 
| 128 | 
            +
                }
         | 
| 129 | 
            +
              },
         | 
| 130 | 
            +
              watch: {
         | 
| 131 | 
            +
                checkValue(newVal, val) {
         | 
| 132 | 
            +
                  if (newVal) {
         | 
| 133 | 
            +
                    this.radioValue = "one";
         | 
| 134 | 
            +
                  } else {
         | 
| 135 | 
            +
                    this.radioValue = null;
         | 
| 136 | 
            +
                    this.message = "";
         | 
| 137 | 
            +
                  }
         | 
| 138 | 
            +
                }
         | 
| 139 | 
            +
              }
         | 
| 140 | 
            +
            };
         | 
| 141 | 
            +
            </script>
         | 
| 70 142 | 
             
            ```
         | 
