element-plus修改主题颜色

在App.vue中

import { onMounted } from "vue";

onMounted(() => {
  // primary
  document.body.style.setProperty("--el-color-primary", "#20A2A2");
  // 鼠标移动到按钮上方时显示的颜色,默认蓝色,可以和primary设置的颜色不一样
  document.body.style.setProperty("--el-color-primary-light-3", "#20A2A2");
  // success
  document.body.style.setProperty("--el-color-success", "#67C23A");
  document.body.style.setProperty("--el-color-success-light-3", "#67C23A");
  // danger
  document.body.style.setProperty("--el-color-danger", "#FAB7C9");
  document.body.style.setProperty("--el-color-danger-light-3", "#FAB7C9");
  // warning
  document.body.style.setProperty("--el-color-warning", "#FFDF73");
  document.body.style.setProperty("--el-color-warning-light-3", "#FFDF73");
});

element-ui更换主题颜色,请看这篇文章

你可能感兴趣的:(UI库,vue.js,javascript,前端,elementui,css)