直接上代码 // 会计算输出一个随机CSS hex color 字符串 如:#baca12 const hexColor = '#'+ (parseInt(Math.random()*0xffffff)).toString(16)