CardWrapper.vue 3.08 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
<template>
	<div class="home-cell">
		<div class="cell-header">
			<div class="cell-header_title">
				<i></i>
				<span>{{title}}</span>
			</div>
			<div>
				<span v-if="isShowSetting" class="el-icon-setting" title="设置" @click="handleSetting"></span>
				<span v-if="isShowRefresh" ref="spanChild" class="el-icon-refresh" title="刷新" @click="handleRefresh"></span>
				<!-- <el-popover
					placement="top-start"
					width="200"
					trigger="hover"
				>
					<div>
						<div style="font-size: 12px;margin-bottom: 10px;">调整卡片宽度</div>
						<el-slider v-model="value" :step="10" show-stops @change="handleChange">
						</el-slider>
					</div>
					<span slot="reference" class="el-icon-s-operation" title="调整" style="margin-left: 5px;"></span>
				</el-popover> -->
			</div>
		</div>
		<div class="line"></div>
		<div class="cell-content">
			<slot></slot>
		</div>
	</div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: "默认标题"
    },
    isShowSetting: {
      type: Boolean,
      default: false
    },
    isShowRefresh: {
      type: Boolean,
      default: false
    },
    componentName: {
      type: String,
      default: ""
    }
  },
  data() {
    return {
      value: 20
    };
  },
  methods: {
    handleSetting() {
      this.$emit("setting");
    },
    handleRefresh() {
      this.$emit("refresh");
    },
    // handleChange(val) {
    //   // 滑块不可小于20%
    //   if (val <= 20) {
    //     this.value = 20;
    //   } else {
    //     this.value = val;
    //   }
    //   this.$emit("adjust", {
    //     value: this.value,
    //     componentName: this.componentName
    //   });
    // }
  }
};
</script>

<style scoped lang="less">
.home-cell {
  background-color: #ffffff;
	box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
	padding: 10px 12px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.cell-header {
  // margin: 10px 20px;
  height: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
	// border-bottom: 2px solid #f7f7f7;
}

.line {
	height: 1px;
	margin-top: 2px;
	background: #E4E4E4;
}

.cell-header_title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  i {
    height: 14px;
    width: 3px;
    background-image: linear-gradient(#4CB4FF, #6F52ED);
    display: inline-block;
    border-radius: 8px;
  }
  span {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		flex: 1;
李少勇 committed
122
		width: 80px;
fukai committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
		height: 25px;
		overflow-wrap: break-word;
		color: rgba(24, 31, 44, 1);
		font-size: 18px;
		font-family: PingFangSC-Medium;
		font-weight: 500;
		text-align: left;
		white-space: nowrap;
		line-height: 25px;
		margin-left: 8px;
  }
}
.cell-header [class^="el-icon-"] {
  font-weight: bold;
  cursor: pointer;
  color: #8e8e8e;
  /* color: #95979b; */
}
.cell-header .el-icon-more {
  color: #95979b;
}
.cell-header [class^="el-icon-"]:hover {
  color: #000;
}
.cell-header /deep/ .el-icon-more {
  transform: rotate(90deg);
}
.cell-content {
	width: 100%;
  height: calc(100% - 25px);
  overflow: auto;
}
</style>