<FormItem class="table-input" :rules="Rules" :prop="`List[${index}].name`">
<Input size="small" :disabled="disabledAll" @input="FreqInput(tableData.List[index].name,index,'List','name',false)" v-model="tableData.List[index].name"></Input>
</FormItem>
data(){
return {
formRangeRules: [{
required: true, type: 'string', message: "",
validator: (rule, value, callback) => {
...
}
}],}
}
methods: {
FreqInput: debounce(function (num, index, type, chin, isclear) {
if (num.toString().split(" ").join("").length === 0) {
let reg = new RegExp(' ', 'g');
this.tableData[type][index][chin] = num.replace(reg, '');
} else {
let isnmber = Number(num);
if (isnmber || isnmber === 0) {
if (num.substr(0, 1) === '.') {
this.tableData[type][index][chin] = isnmber;
}
if (Number(num) >= 10000000) {
if (isclear) {
this.tableData[type][index][chin] = "";
}
} else {
if (num && num.toString().includes(".")) {
if (num.toString().split(".")[1].length > 6) {
this.tableData[type][index][chin] = this.toFixed(num, 6)
}
}
}
} else {
this.tableData[type][index][chin] = "";
}
}
}, 300),
}
function Throttle(fn, t) {
let last;
let timer;
let interval = t || 500;
return function () {
let args = arguments;
let now = +new Date();
if (last && now - last > interval) {
clearTimeout(timer);
timer = setTimeout(() => {
last = now;
fn.apply(this, args);
}, interval);
} else {
last = now;
fn.apply(this, args);
}
};
}
function debounce(fn, t) {
let delay = t || 500;
let timer;
return function () {
let args = arguments;
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
timer = null;
fn.apply(this, args);
}, delay);
};
}