先给el-button组件添加一个自定义的类名,然后在全局样式文件或者当前组件的标签内定义该类名下的样式,从而覆盖默认的颜色样式。 html <el-button class="my-btn">我的按钮</el-button> css .my-btn { background-color: #4caf50; color: #ffffff; } 4.
一、先直接上解决方案,再讲解源码。 this.$confirm('', { title:"提示", message:"确认删除?", iconClass:"el-icon-question colorYellow", }).then(() => { }) 1. 2. 3. 4. 5. 6. 7. el-icon-question是element的图标。colorYellow为颜色样式 这里说明下,colorYellow必须写在全局样式文件内才管用...