精度:10
长度:30
bug:可以单独输入负号-,小数点.

<el-input v-if="node.pattern.rightSource == 'Custom'" v-model.number="node.pattern.rightValue" placeholder="请输入右值" style="width: 240px" maxlength="30" @input="handleInput" show-word-limit />
const handleInput = (value) => { // 允许正负数和小数,小数点后最多10位 const regex = /^-?\d*(\.\d{0,10})?$/; // 如果不符合格式,移除最后一个字符 if (!regex.test(value)) { value = value.slice(0, -1); } // 更新绑定值 props.node.pattern.rightValue = value }
浙公网安备 33010602011771号