popupComp.vue 1.98 KB
<template>
  <van-popup v-model="show" position="bottom" round :style="{ 'min-height': '40%', 'max-height': '80%', 'overflow-y': 'hidden', 'padding-bottom': '30px' }">
    <div class="popup-header">
      <div class="popup-title">访问记录</div>
      <div class="popup-icon"><van-icon name="cross" @click="updateShow" /></div>
    </div>
    <div class="popup-content">
      <div class="popup-content-header">
        <div class="popup-item">序号</div>
        <div class="popup-item">访问页面</div>
        <div class="popup-item">访问时间</div>
      </div>
      <div class="popup-content-body" v-for="(item, index) in list" :key="item.id">
        <div class="popup-item">{{ index + 1 }}</div>
        <div class="popup-item">{{ item.pageName }}</div>
        <div class="popup-item">{{ item.createdTime }}</div>
      </div>
    </div>
  </van-popup>
</template>
<script>
export default {
  data() {
    return {}
  },
  props: {
    show: {
      default: false,
      type: Boolean
    },
    list: {
      default: () => [],
      type: Array
    }
  },
  methods: {
    updateShow() {
      this.$emit('update:show', false)
    }
  }
}
</script>
<style scoped lang="scss">
.popup-header {
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0px 16px;
  .popup-title {
    font-weight: 600;
    font-size: 16px;
    color: #222222;
  }
}
.popup-content {
  max-height: calc(80vh - 50px);
  overflow: auto;
  &-header {
    display: flex;
    height: 40px;
    line-height: 48px;
    background: #f2f2f2;
    text-align: center;
    .popup-item {
      font-weight: 600;
      font-size: 14px;
      color: #333333;
    }
  }
  &-body {
    display: flex;
    height: 48px;
    line-height: 48px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    text-align: center;
  }
  .popup-item {
    font-size: 14px;
    color: #666666;
    &:first-child {
      width: 60px;
    }
    &:nth-child(2),
    &:nth-child(3) {
      flex: 1;
    }
  }
}
</style>