123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <div
- class="basic-container"
- :style="styleName"
- :class="{ 'basic-container--block': block }"
- >
- <el-card class="basic-container__card">
- <div v-show="show">
- <slot></slot>
- </div>
- <div v-if="showBtn" class="basic-container-foot" @click="show = !show" @mouseenter="enter" @mouseleave="leave">
- <div v-show="show">
- <i class="el-icon-caret-top" /><span v-show="showSpan">隐藏</span>
- </div>
- <div v-show="!show">
- <i class="el-icon-caret-bottom" /><span v-show="showSpan">显示</span>
- </div>
- </div>
- </el-card>
- </div>
- </template>
- <script>
- export default {
- name: "basicContainer",
- data() {
- return {
- show: true,
- showSpan: false
- };
- },
- props: {
- radius: {
- type: [String, Number],
- default: 10
- },
- background: {
- type: String
- },
- block: {
- type: Boolean,
- default: false
- },
- showBtn: {
- type: Boolean,
- default: false
- }
- },
- methods: {
- enter() {
- this.showSpan = true;
- },
- leave() {
- this.showSpan = false;
- }
- },
- computed: {
- styleName() {
- return {
- borderRadius: this.setPx(this.radius),
- background: this.background
- };
- }
- }
- };
- </script>
- <style lang="scss">
- .basic-container {
- padding: 5px 6px;
- box-sizing: border-box;
- &--block {
- height: 100%;
- .basic-container__card {
- height: 100%;
- }
- }
- &__card {
- width: 100%;
- }
- &:first-child {
- padding-top: 6px;
- }
- &-foot {
- cursor: pointer;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #d3dce6;
- span {
- margin-left: 4px;
- font-size: 14px;
- }
- }
- &-foot:hover {
- color: #409eff;
- }
- }
- </style>
|