随机分配颜色 color = '#' + Math.floor(Math.random() * 0xFFFFFF).toString(16); 这样便可以随机生成颜色,直接用于设置。 一般用于需要给多种标签设置不同的颜色。