123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <template>
- <div class="com-panel" :class="{ 'no-title': !hasTitle, line: showLine }">
- <div v-if="hasTitle" class="panel-header">
- <div class="panel-title">
- <i v-if="hasIcon" class="panel-icon" :class="icon"></i>
- {{ title }}
- </div>
- <div class="panel-tools">{{ subTitle }}</div>
- </div>
- <div class="panel-body" :class="{ blur: bgBlur }">
- <slot></slot>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "com-panel",
- componentName: "com-panel",
- props: {
- // 标题
- title: String,
- // 图标
- icon: String,
- // 副标题
- subTitle: String,
- showLine: {
- type: Boolean,
- default: true,
- },
- bgBlur: {
- type: Boolean,
- default: false,
- },
- },
- computed: {
- // 是否存在标题
- // 标题为空时 不显示标题框
- hasTitle() {
- if (this.title) return true;
- return false;
- },
- // 是否存在图标
- hasIcon() {
- if (this.icon) return true;
- return false;
- },
- },
- };
- </script>
- <style lang="less">
- .com-panel {
- &.line {
- border-left: 1px solid gray;
- }
- &.line:before {
- content: " ";
- width: 3px;
- height: 3px;
- float: left;
- background: #c9c9c9;
- margin: 0.185vh 0.556vh 0vh 0.185vh;
- }
- &.no-title {
- border-left: 0vh;
- }
- &.no-title::before {
- display: none;
- }
- .panel-header {
- display: flex;
- font-size: 14px;
- padding-left: 1.185vh;
- background: rgba(255, 255, 255, 10%);
- line-height: 27px;
- margin-bottom: 0.7407vh;
- height: 27px;
- .panel-title {
- color: fade(#fff, 75);
- flex: 1 1 auto;
- .panel-icon {
- margin-right: 10px;
- }
- }
- .panel-tools {
- flex: 0 0 auto;
- color: #ffffff4d;
- padding: 0 10px;
- font-size: 12px;
- letter-spacing: 0.093vh;
- }
- }
- .panel-body {
- position: relative;
- }
- &.line .panel-body {
- padding-left: 1.185vh;
- }
- &.no-title .panel-body {
- padding-left: 0vh;
- }
- }
- </style>
|