//添加类名变量let danmakuWrapper = `.danmaku-wrapper{color:${this.danmakuData.color};font-size:${this.danmakuData.height}px;background:${this.danmakuData.bgColor};line-height:1 !important;}`function addNewStyle(newStyle) {//获取样式文件var styleElement = document.getElementById('styles_js');if (!styleElement) {//新增样式文件styleElement = document.createElement('style');styleElement.type = 'text/css';styleElement.id = 'styles_js';document.getElementsByTagName('head')[0].appendChild(styleElement);}//插入文档流styleElement.appendChild(document.createTextNode(newStyle));}addNewStyle(danmakuWrapper);
900字范文,内容丰富有趣,生活中的好帮手!