SOURCE

<script>
/*
  **************************************************
  version: '0.10'
  author": "46898"
  description": 标题组件
  **************************************************
 */
export default {
  name: 'SubTitle',
  inheritAttrs: false,
  props: {
    // 名称
    title: {
      type: String
    },
    // 级别
    level: {
      type: String,
      default: '1',
      validator (value) {
        return [
          '1',
          '2',
          '3',
          '4'
        ].indexOf(value) > -1
      }
    }
  },
  data () {
    return {
    }
  },
  computed: {
  },
  methods: {

  },
  mounted () {
  },
  render () {
    const { level, title, $route: { meta, query, params }, $slots } = this
    const tag = `h${Number(level) + 2}`
    const defaultTitle = (typeof meta['title'] === 'string') ? meta['title'] : meta['title'][params['type'] || query['type']]
    const other = $slots.default ? <div class="page-subTitle-other">{$slots.default}</div> : ''
    return (<div class={`page-subTitle page-subTitle-level${level}`} ><tag><span>{title || defaultTitle}</span></tag>{other}</div>)
  }
}
</script>

<style lang="scss">
.page-subTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 $content-spacing 0 0;
  &.page-subTitle-level1 {
  }
  &.page-subTitle-level2 {
    border-bottom: 1px solid #e8eaf0;
  }
  h3 {
    position: relative;
    padding: 26px $content-spacing;
    font-size: 18px;
    color: $text-color;
    line-height: 20px;
    font-weight: bold;
    &::before {
      position: absolute;
      content: "";
      left: 0;
      top: 50%;
      width: 4px;
      height: 20px;
      transform: translateY(-50%);
      border-radius: 0 4px 4px 0px;
      background: $primary-color;
    }
  }
  h4 {
    position: relative;
    font-size: 16px;
    line-height: 50px;
    padding: 0 0 0 $content-spacing;
    color: $text-color-secondary;
    font-weight: bold;
    span {
      position: relative;
      display: inline-block;
      padding: 0 0 0 $content-spacing;
      background: url(../assets/images/icon-edit.png) left center no-repeat;
      &::before {
        position: absolute;
        content: "";
        left: 0;
        right: 0;
        bottom: 0;
        height: 2px;
        background: $primary-color;
      }
    }
  }
  h5 {
    position: relative;
    line-height: 46px;
    text-indent: 20px;
    color: $text-color;
    font-size: 16px;
    background: url(../assets/images/icon-title1.png) left center no-repeat;
  }
  .page-subTitle-other {
    .el-button--default.is-plain {
      position: relative;
      padding: 8px 12px 8px 30px;
      &:not(.is-disabled) {
        border-color: $primary-color;
        color: $primary-color;
      }
      &:not(.is-disabled):hover,
      &:not(.is-disabled):focus {
        background: #f2f5fc;
        color: #3060ff;
        border-color: #3060ff;
        &::before {
          background: url(../assets/images/icon-add2.png) left center no-repeat;
        }
      }
      &::before {
        content: "";
        position: absolute;
        left: 10px;
        top: 50%;
        width: 14px;
        height: 14px;
        transform: translateY(-50%);
        background: url(../assets/images/icon-add1.png) left center no-repeat;
      }
      &.export-btn::before {
        background: url(../assets/images/icon-export1.png) left center no-repeat;
      }
      &.export-btn {
        &:hover,
        &:focus {
          &::before {
            background: url(../assets/images/icon-export2.png) left center
              no-repeat;
          }
        }
      }
    }
  }
}
</style>
console 命令行工具 X clear

                    
>
console