vue中sass样式的引用和定义全局样式(二)

vue中sass样式的引用和定义全局样式(二)

2.4、src/assets/styles/lib/common.scss

全局自定义样式(文本颜色、背景颜色、盒模型布局)
$nav-header-color-bg: #001529;
$nav-header-color: #fff;

// 颜色
$main-color: #1890ff;
$success-color: #52c41a;
$error-color: #f5222d;
$color-font: #333333;
$main-color-light: #ecf5ff;
$assist-color: #666666;
$desc-color: #999999;
$invalid-color: #CCCCCC;
$color-font: #333333;
$main-color-light: #ecf5ff;
$border-color: #f1f1f1;
// 边距
$blank-spacing: 24px;
$inline-spacing: 16px;
$assist-spacing: 8px;
// 字体
$base-fs: 12px;
$base-lh: 22px;
$title-fs: 16px;
// 表格
$thead-h: 48px;
$thead-bg: #f1f1f1;
$thead-fs: 12px;
$thead-fw: bold;
$thead-color: #333333;
$td-h: 48px;
// 圆角
$--border-radius-base: 4px !default;
// 边框颜色
$--border-color-base: #D9D9D9 !default;
// 输入框高度
$--input-height: 32px !default;
// input
$--input-font-color: #666666 !default;
$--datepicker-font-color: #666666 !default;
// placeholder
$--color-text-placeholder: #CCCCCC !default;
// switch
//$--switch-off-color: rgba(0, 0, 0, .25) !default;
$--switch-off-color: #b6b6b6 !default;
$--switch-height: 20px !default;
$--switch-core-border-radius: 10px !default;
// 默认字体颜色
$--color-text-regular: #333333 !default;
$edit-input-width: 294px;

2.51、src/assets/styles/lib/element-ui.scss

全局修改element UI样式(常用组件)
/*重置一些样式*/

@import "element-variables";

/* 改变主题色变量 */

$--color-primary: $main-color;
$--color-success: $success-color;
$--color-danger: $error-color;
$--color-text-primary: $color-font;
$--font-size-base: $base-fs; // 基础字体大小
$--table-border-color: #EAEAEA; // 表格边框颜色
$--table-row-hover-background-color: #E8F4FF; // 表格 hover 背景颜色
$--color-primary: #1890ff;
.el-select,
.el-input {
    width: 100%;
    min-height: 32px;
}

//字号
.el-input__inner,
.el-range-input {
    font-size: 12px !important;
}

::-webkit-scrollbar {
    width: 9px !important;
    height: 10px !important;
    box-sizing: border-box;
}

.el-pagination__jump {
    display: inline-flex !important;
    align-items: center;
}

/*el-dailog-header 统一12px*/

#content {
    display: flex;
    background-color: #fff;
    padding-top: 16px;
}

.el-upload-input .focusing:focus {
    outline: 0 !important;
}

#treeDialog {
    min-width: 150px;
}

.el-dialog {
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    margin: 0 auto !important;
    font-size: 12px;
    overflow: hidden;
    border-radius: 4px !important;
    .el-card.is-always-shadow {
        box-shadow: none;
        border: none;
    }
    .el-input,
    .el-textarea,
    p,
    span,
    div {
        font-size: 12px;
    }
    /*搜索区域*/
    .el-form.wrap-294 {
        .el-input,
        .el-select,
        .el-form-item__content {
            width: 294px !important;
        }
    }
    /*dialog  form 下面的input 全部294px*/
    .el-row {
        .el-col {
            font-size: 12px;
        }
    }
    .el-dialog__title {
        font-size: 16px;
        font-weight: bold;
        color: #333333;
    }
    .el-dialog__header {
        padding: 16px 24px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.09);
    }
    .el-dialog__body {
        padding: 16px 24px;
        max-height: calc(70vh - 130px);
        overflow-y: auto;
    }
}

.el-textarea {
    .el-textarea__inner {
        height: 88px;
        min-height: 88px;
    }
}

.el-form-item__error {
    word-break: keep-all;
}

.staff-select_popper {
    &.el-autocomplete__popper {
        width: 240px;
        .el-autocomplete-suggestion {
            width: 100% !important;
        }
    }
    .el-input-group__append {
        padding: 0 10px;
        background: #1890ff;
        color: white;
    }
}

.el-table .el-table__header th {
    background-color: $thead-bg;
    font-size: $thead-fs;
    font-weight: $thead-fw;
    color: $thead-color;
    height: $thead-h;
    line-height: $thead-h;
}

.el-card .el-card__header {
    border-bottom: 0;
    padding: 24px 24px 0;
}

.el-card .el-card__body {
    padding: 0;
    height: 100%;
    box-sizing: border-box;
    flex-direction: column;
}

.yzl-table {
    flex: 1;
}

.yzl-el-table {
    width: calc(100% - 12px);
}


/* 改变 icon 字体路径变量,必需 */

$--font-path: '~element-plus/lib/theme-chalk/fonts';
@import '~element-plus/packages/theme-chalk/src/index';
.el-form-item--small.el-form-item {
    margin-bottom: 24px;
}

.el-form--inline .el-form-item__content,
.el-form--inline .el-form-item {
    vertical-align: middle !important;
}

.shrink-0 {
    flex-shrink: 0;
}
/**
  el-dialog 垂直居中,动画需要改变
 */

@keyframes dialog-fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes dialog-fade-out {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.no-bottom-card .el-card {
    margin-bottom: 0;
}

.no-bottom-card .form-line {
    margin-right: 12px;
}

.dialog-wait{
    .el-dialog__body{
        padding:0 ;
        max-height: 100%;
        overflow-y: hidden;
    }
}

.dialog-fixed-height {
    .el-dialog__body {
        height: 600px;
        box-sizing: border-box;
    }
}

.max-dialog {
    .el-dialog__body {
        max-height: 600px;
        box-sizing: border-box;
        overflow: auto;
    }
}


/** loading **/

//处理全局的loading-mask 为 透明
.el-loading-parent--relative {
    .el-loading-mask {
        background-color: transparent;
    }
}

.el-popper {
    max-width: 40vw;
    line-height: 24px;
    //max-height: 90vh;
    //overflow-y: auto;
}

.el-tooltip__popper.is-dark,
.el-popper.is-dark[role=tooltip] {
    max-width: 300px;
}

.table-button-group_dropdown-item .el-button {
    width: 100%;
}


/*button text 字号*/

.el-button--small {
    font-size: 12px;
}

.theme-el-tree.el-tree {
    .el-tree-node__expand-icon:not(.is-leaf) {
        &::before {
            display: inline-block;
            content: '';
            box-sizing: border-box;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #faad14;
            border: 0px solid #52c41a;
        }
        &.expanded {
            &::before {
                background-color: transparent;
                border-width: 1px;
            }
        }
    }
    // .is-expanded .el-tree-node__expand-icon.is-leaf{
    //   &::after{
    //     display: inline-block;
    //     content: '';
    //     height: 24px;
    //     border-left: 1Px dashed #d1d1d1;
    //     transform: translateX(-10px);
    //   }
    // }
    .el-tree-node__content {
        height: auto !important;
    }
    .el-tree-node.is-current>.el-tree-node__content,
    .el-tree-node.is-focusable>.el-tree-node__content:hover {
        background-color: transparent !important;
        color: #333333 !important;
        border-radius: 0 !important;
    }
    .el-tree-node:focus {
        &>.el-tree-node__content {
            background-color: transparent !important;
        }
    }
    .custom-tree-node {
        line-height: 22px;
        font-weight: normal;
    }
    .el-tree-node__label {
        font-weight: 500;
    }
    .is-current>.el-tree-node__content {
        .over-flow {
            color: white !important;
        }
        .custom-tree-node,
        &.el-tree-node__label {
            box-sizing: border-box;
            padding: 2px 8px;
            background-color: #1890ff;
            color: white !important;
            border-radius: 4px;
        }
    }
}

table.custom-table {
    box-sizing: border-box;
    width: 100%;
    border-width: 1Px 0 0 1Px;
    border-spacing: 0;
    border-color: #eaeaea;
    border-style: solid;
    line-height: 1;
    border-radius: 4px;
    tr {
        th {
            background-color: #f1f1f1;
        }
        td,
        th {
            box-sizing: border-box;
            padding: 14px 24px;
            border-width: 0 1Px 1Px 0;
            border-style: solid;
            border-color: #eaeaea;
        }
        &:last-child {
            td:first-child {
                border-radius: 0 0 0 4px;
            }
            td:last-child {
                border-radius: 0 0 4px;
            }
        }
    }
}

.el-alert--primary {
    background-color: #e8f4ff;
    color: #333333;
    border: 1px solid #8bc7ff;
    .el-alert__content {
        font-size: 12px;
    }
    .el-alert__icon {
        color: #1890ff;
    }
}

//table样式
.el-table--small th {
    padding: 0;
}

.scroll-y {
    overflow-y: scroll;
}

.el-table th,
.el-table thead.is-group th {
    background: #f1f1f1;
    font-size: 12px;
    font-weight: bold !important;
    color: #333333;
    height: 48px;
}

.theme-el-popper {
    width: 30vw;
    overflow-x: auto;
}

.rule-template-form {
    .el-form-item {
        white-space: nowrap;
        .el-input {
            width: 125px;
        }
    }
    .row-center {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }
    .form-item-wrap {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .el-form-item__label {
            padding-right: 0 !important;
            white-space: normal;
            line-height: 1.8;
            text-align: center;
        }
    }
    .border-line {
        margin-bottom: 15px;
        width: 98%;
        height: 1px;
        background: #ccc;
    }
    .el-form-item {
        margin-bottom: 16px;
        .el-form-item__label {
            padding-right: 8px;
        }
    }
    .width-72 {
        width: 72px;
    }
    .width-90 {
        width: 90px !important;
        .el-input {
            width: 90px !important;
        }
        .el-input__inner {
            padding: 0 5px;
        }
    }
    .width-120 {
        width: 120px;
    }
    .width-146 {
        width: 146px;
    }
    .width-150 {
        width: 150px;
    }
    .width-160 {
        width: 160px;
    }
    .width-180 {
        width: 180px;
    }
    .operate-btns {
        span {
            margin-right: 10px;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            width: 14px;
            height: 14px;
            font-size: 14px;
            line-height: 1;
            cursor: pointer;
            .el-icon-minus {
                color: #666666;
                border: 1px solid #eaeaea;
            }
            .el-icon-plus {
                color: #1890ff;
                border: 1px solid #1890ff;
            }
        }
    }
}

.el-tabs__nav-wrap::after {
    height: 0;
}

.el-image-viewer__close {
    margin-top: 40px;
}
/*去掉upload 上传过渡效果*/
.el-upload-list__item {
    transition: none !important;
}

2.52、src/assets/styles/lib/element-variables.scss

全局修改element UI样式(常用样式)
$nav-header-color-bg: #001529;
$nav-header-color: #fff;

// 颜色
$main-color: #1890ff;
$success-color: #52c41a;
$error-color: #f5222d;
$color-font: #333333;
$main-color-light: #ecf5ff;
$assist-color: #666666;
$desc-color: #999999;
$invalid-color: #CCCCCC;
$color-font: #333333;
$main-color-light: #ecf5ff;
$border-color: #f1f1f1;
// 边距
$blank-spacing: 24px;
$inline-spacing: 16px;
$assist-spacing: 8px;
// 字体
$base-fs: 12px;
$base-lh: 22px;
$title-fs: 16px;
// 表格
$thead-h: 48px;
$thead-bg: #f1f1f1;
$thead-fs: 12px;
$thead-fw: bold;
$thead-color: #333333;
$td-h: 48px;
// 圆角
$--border-radius-base: 4px !default;
// 边框颜色
$--border-color-base: #D9D9D9 !default;
// 输入框高度
$--input-height: 32px !default;
// input
$--input-font-color: #666666 !default;
$--datepicker-font-color: #666666 !default;
// placeholder
$--color-text-placeholder: #CCCCCC !default;
// switch
//$--switch-off-color: rgba(0, 0, 0, .25) !default;
$--switch-off-color: #b6b6b6 !default;
$--switch-height: 20px !default;
$--switch-core-border-radius: 10px !default;
// 默认字体颜色
$--color-text-regular: #333333 !default;
$edit-input-width: 294px;
上一篇:cf232 B. Table(dp)


下一篇:安装node-sass,遇到的问题及解决办法