<template>
  <section class="AiTopFixed" :style="{background}">
    <!--占位区-->
    <div class="placeholder">
      <div v-if="$slots.tabs">
        <slot name="tabs"/>
      </div>
      <div class="content" v-if="$slots.default">
        <slot/>
      </div>
    </div>
    <!--悬浮区-->
    <div class="fixed" :style="{background}">
      <div v-if="$slots.tabs">
        <slot name="tabs"/>
      </div>
      <div class="content" v-if="$slots.default">
        <slot/>
      </div>
    </div>
  </section>
</template>

<script>
export default {
  name: "AiTopFixed",
  props: {
    background: {default: "#fff"}
  }
}
</script>

<style lang="scss" scoped>
.AiTopFixed {
  width: 100%;

  & > div {
    width: 100%;
  }

  .fixed {
    width: 100%;
    min-height: 100px;
    top: 0;
    position: fixed;
    z-index: 9;
  }

  .placeholder {
    visibility: hidden;
    opacity: 0;
  }

  .content {
    min-height: 100px;
    padding: 20px 32px;
    box-sizing: border-box;

    *:last-child {
      margin-bottom: 0 !important;
    }
  }

  ::v-deep .u-search {
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.02);
    margin-bottom: 32px !important;
  }
}
</style>
