第一种方法
index.html中添加
<style id="style"></style>
接口获取到颜色后
const IPT = '!important;'
const btnColor = '#fff'
const styleText = '.el-radio__input.is-checked + .el-radio__label {' +
' color: ' + btnColor + IPT +
'}' +
'.el-radio__input.is-checked .el-radio__inner {' +
' background: ' + btnColor + IPT +
' border-color: ' + btnColor + IPT +
'}' +
'.el-checkbox__input.is-checked .el-checkbox__inner {' +
' background-color: ' + btnColor + IPT +
' border-color: ' + btnColor + IPT +
'}' +
'.is-checked {' +
' .el-checkbox__label {' +
' color: ' + btnColor + IPT +
' }' +
'}'
}
document.querySelector('#style').innerHTML = styleText