<template>
  <div class="main-page">
    <ul class="main-page-nav">
      <li v-for="(item, index) in data.slider" :key="index" :class="{ 'is-active': isAcitve(item) }">
        <nuxt-link :to="item.path">{{ item.name }}</nuxt-link>
      </li>
    </ul>
    <div class="main-page-content">
      <img v-if="data.banner" :src="data.banner" class="main-page-banner" />
      <div class="main-content-html">
        <slot></slot>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'appFrame',
  props: {
    data: { type: Object }
  },
  methods: {
    isAcitve(item) {
      return this.$route.fullPath.includes(item.path)
    }
  }
}
</script>
<style lang="scss">
.is-pc {
  .main-page {
    width: 1200px;
    margin: 0 auto;
    padding: 56px 0 100px;
    display: flex;
  }
  .main-page-nav {
    width: 160px;
    background: #fff;
    padding: 35px 0 44px;
    margin-right: 40px;
    align-self: flex-start;
    li {
      position: relative;
      height: 40px;
      font-size: 22px;
      line-height: 40px;
      text-align: center;
      color: #777777;
      cursor: pointer;
      &.is-active {
        color: #aa1941;
        &::after {
          content: '';
          width: 8px;
          height: 40px;
          background: #aa1941;
          position: absolute;
          top: 0;
          left: 0;
        }
      }
    }
    li + li {
      margin-top: 60px;
    }
  }
  .main-page-content {
    flex: 1;
    background-color: #fff;
    overflow: hidden;
  }
  .main-page-banner {
    display: block;
    height: 320px;
    object-fit: cover;
  }
}
.is-h5 {
  .main-page-nav {
    display: flex;
    li {
      margin-left: 0.3rem;
      font-size: 0.14rem;
      line-height: 0.38rem;
      color: #333;
      &.is-active {
        border-bottom: 0.02rem solid #aa1941;
      }
    }
  }
  .main-page-banner {
    display: block;
    width: 100%;
    // height: 1.2rem;
    // object-fit: cover;
  }
  .main-page-content {
    background-color: #fff;
  }
}
</style>