<template>
  <div class="popup-layout j-container">
    <div class="j-header">
      <slot name="header">
        <div class="header-nav">
          <div class="header-nav-title">
            <slot name="title">
              {{ title }}
            </slot>
          </div>
          <div
            class="header-nav-close"
            name="clear"
            @click="closeIconClick"
          />
        </div>
      </slot>
    </div>
    <div class="j-main">
      <slot name="default" />
    </div>
    <div class="j-footer">
      <slot name="footer" />
    </div>
  </div>
</template>

<script>
export default {
  name: 'PopupLayout',
  props: {
    title: {
      type: String,
      default: '选择'
    }
  },
  methods: {
    closeIconClick() {
      this.$emit('closeIconClick')
    }
  }
}
</script>

<style lang="scss" scoped>
.header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  .header-nav-title {
    font-size: 20px;
    color: #171826;
  }
  .header-nav-close {
    font-size: 22px;
    color: #c8c9cc;
  }
}
.popup-layout {
  .j-main > * {
    max-height: 60vh;
  }
}
</style>
