1.一键复制
const handleCopy = (text: string) => {
let oInput = document.createElement('input');
oInput.value = text;
document.body.appendChild(oInput);
oInput.select(); // 选择对象;
document.execCommand("Copy"); // 执行浏览器复制命令
oInput.remove();
ElMessage({
type: 'success',
message: '复制申请编号成功!'
});
}
2.千位符分割展示
function format (num) {
num = num + ''
var reg = /[1-9]\d{0,2}(?=(\d{3})+$)/g
return num.replace(reg, '$&,')
}