单选框选中时对应输入框可输入

单选框选中时对应输入框可输入

首先在el-radio-group绑定v-model,再设置每个单选框的el-radio的label值,再绑定el-input的:disabled,表示当form的model不等于绑定的radio的label值时为true,可输入,否则一直禁止。

<el-form-item label="路径工作方式">
          <el-radio-group v-model="form.mode">
            <el-radio label="single">单候选最优路径</el-radio>
            <el-radio label="backup">主备候选最优路径</el-radio>
            <el-radio label="multi-cp-single-list">多候选路径单分段路径</el-radio>
            <div class="border">
              <el-form-item label="期望路径条数">
                 <el-input v-model="form.evadeLink" :disabled="form.mode!=='multi-cp-single-list'"></el-input>
              </el-form-item>
            </div>
            <el-radio label="single-cp-multi-list">单候选路径多分段路径</el-radio>
            <div class="border">
              <el-form-item label="期望负载分担条数" label-width="160px">
                <el-input v-model="form.necessaryLink" :disabled="form.mode!=='single-cp-multi-list'"></el-input>
              </el-form-item>
            </div>
          </el-radio-group>
        </el-form-item>

你可能感兴趣的:(javaScript,javascript,html,html5)