export function numberToColor(text, color = '#635BFF', size = '12px') { let reg = /(\d+)/g; return text.replace(reg, `<span style="color: ${color};size: ${size}">$1</span>`); }
效果:
标签:样式,text,js,React,文本,reg From: https://www.cnblogs.com/Blogzlj/p/16994175.html