ElMessageBoxconfirm button换颜色
要更改ElMessageBox.confirm按钮的颜色,可以使用以下方法:
-
使用CSS样式更改按钮的颜色:
.el-message-box__btns .el-button--primary { background-color: red; /* 更改为你想要的颜色 */ }这将更改所有ElMessageBox.confirm按钮的颜色为红色。
-
通过更改全局的Element UI主题颜色来更改按钮的颜色。 首先,在你的项目中创建一个自定义的Element UI主题文件(例如theme.scss),并将其导入到你的样式文件中。
// theme.scss $--color-primary: red; // 更改为你想要的颜色 @import 'element-ui/packages/theme-chalk/src/index';然后,在你的入口文件(main.js或main.ts)中导入主题样式文件。
// main.js or main.ts import 'path/to/theme.scss';这将更改整个Element UI组件库中的主题颜色,包括ElMessageBox.confirm按钮。
请注意,以上方法中的颜色值可以根据你的需求进行调整
原文地址: https://www.cveoy.top/t/topic/hVnT 著作权归作者所有。请勿转载和采集!