jsp:

 <div class="radio-box">
    <input name="sex" type="radio" value="0" checked>
    <label>男</label>
</div>
<div class="radio-box">
    <input name="sex" type="radio"value="1">
   <label>女</label>
</div>

vue获取值:

 queryDate: function () {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: "${ctx}/operator/operationOne",
                    dataType: "JSON",
                    data: {"operId": that.operId},
                    success: (res) => {
                        if (res.state) {
                            let result = res.result;
                           $('input[name=sex][value=' + result.gender + ']').iCheck('check');
                        }
                    }
                });
            },

保存时取选中值:

 let gender=$("input[name='sex']:checked").val();
Logo

前往低代码交流专区

更多推荐