BasicLayout.vue 2.29 KB
<template>
  <el-container>
    <el-header>
      <global-header />
    </el-header>
    <el-main class="content-container">
      <div class="condition">
        <div class="condition-top">
          <span class="content-title">
            演示项目 2020-06-10 客流综合数据统计
          </span>
          <span
            class="pointer other-options"
            :class="{ collapsed: !collapsed }"
            @click="collapsed = !collapsed"
          >
            其他日期选项
            <i class="el-icon-arrow-right condition-icon-arrow"></i>
          </span>
        </div>
        <div v-show="!collapsed" class="collapsed-content">
          <date-options :defaults-date.sync="dateType" />
          collapsed content
        </div>
      </div>
      <div class="content" :style="{ marginTop: collapsed ? '72px' : '132px' }">
        <router-view />
      </div>
    </el-main>
  </el-container>
</template>

<script>
import GlobalHeader from './components/GlobalHeader'
import DateOptions from '@/components/Conditions/DateOptions'

export default {
  name: 'BasicLayout',
  components: { GlobalHeader, DateOptions },
  data() {
    return {
      collapsed: false,
      dateType: 'day'
    }
  }
}
</script>

<style lang="scss">
@import '~@/styles/variables.scss';

.content-container {
  padding: 0;
  margin-bottom: 40px;
}
.content {
  margin: $headerHeight 165px 0;
  background-color: #ccc;
  color: #333;
  text-align: center;
  height: 100vh;
  box-shadow: 0 0 3px 0 rgba(0, 0, 0, 1);
  transition: all 0.3s linear;
}

.condition {
  width: 100%;
  position: fixed;
  top: $headerHeight;
  z-index: 2;
  background: #fff;
  text-align: center;
  box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.1);
  .content-title {
    font-size: 20px;
    color: #555;
  }

  .other-options {
    float: right;
    position: relative;
    right: 165px;
    top: 6px;
    font-size: 13px;
    color: #666;

    .condition-icon-arrow {
      margin-left: 8px;
      transition: transform 0.3s;
    }

    &.collapsed .condition-icon-arrow {
      transform: rotate(90deg);
    }
  }

  .condition-top {
    line-height: 60px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  .collapsed-content {
    background: #fff;
    height: 58px;
    line-height: 58px;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.1);
  }
}
</style>