When the el-input type is number, the non-numeric types are not completely restricted (the letters'e' and decimal points are allowed to be entered). What should I do?

phenomenon is described in the title,

the code is as follows:

<el-form-item label="" prop="first_channel_code">
   <el-input type="number" v-model.number="ruleForm.first_channel_code"></el-input>
</el-form-item> -sharp-sharp-sharp 

three ways:
1. Native

<el-input type="number" :min="0" v-model="form.zs" placeholder="()" clearable style="width:300px;" @keyup.native="form.zs = oninput(form.zs)">
<template slot="append"></template></el-input>

/ / filter two decimal places

oninput(val) {
  return val ? val.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : null
}

II. El-input-number tags included in elementui components
III. Regular verification of rules
phone: [

    {
        required: true,
        message: "",
        trigger: "blur"
    },
    {
        pattern: /^1[1-9]\d{9}$/,
        message: "",
        trigger: "blur"
    }
],

e and decimal point are also part of the number. This problem also exists in native input. If you want to completely solve this problem, you can only rely on js control


if you want to limit, you can listen for changes in watch to control non-numeric types.


the best compatibility is to write regularities in @ input, then add e letters or decimal points to filter


Thank you for sharing. Finally, it is solved by monitoring keyboard input events. The code is as follows:

<el-form-item label="" prop="first_channel_code">
  <el-input type="number" v-model.number="ruleForm.first_channel_code" @keydown.native="channelInputLimit"></el-input>
</el-form-item>

// bug fix:number'e''.'
channelInputLimit (e) {
  let key = e.key
  // 'e''.'
  if (key === 'e' || key === '.') {
    e.returnValue = false
    return false
  }
  return true
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf458c-31670.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf458c-31670.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?