输入框只能输入1-100之间的整数

 <el-form-item 
                v-if="strategyInfoForm.mode == 'factor'"
                label="多头比列:" 
                prop="selection_level"
            >
                <el-input
                    v-model="otherForm.long_position"
                    placeholder="请输入多头比列"
                    onkeyup="value=value.replace(/[^\d||/.]/g,'')"
                    oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>100){value=100}"
                    :maxlength="3"
                    :minlength="1"
                    @input="inputParams"
                >
                    <i slot="suffix" style="color: #000;font-style:normal;margin-right: 10px;">%</i>
                </el-input>
			</el-form-item>

οnkeyup="value=value.replace(/[^\d||/.]/g,'')"

οninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>100){value=100}"

:maxlength="3"

:minlength="1"

Logo

前往低代码交流专区

更多推荐