<template>
  <el-affix>
    <div class="p-footer-bg">
      <div class="p-footer">
        <ul>
          <li :class="{current:routePath=='/'}">
            <NuxtLink to="/">
              <img src="@/assets/img/home/f_home_0.svg" class="check">
              <img src="@/assets/img/home/f_home_1.svg">
              <p>首页</p>
            </NuxtLink>
          </li>
          <li :class="{current:routePath=='/category'}">
            <NuxtLink to="/category">
              <img src="@/assets/img/home/f_cate_0.svg" class="check">
              <img src="@/assets/img/home/f_cate_1.svg">
              <p>选型</p>
            </NuxtLink>
          </li>
          <li :class="{current:routePath=='/cart'}">
            <NuxtLink to="/cart">
              <img src="@/assets/img/home/f_cart_0.svg" class="check">
              <img src="@/assets/img/home/f_cart_1.svg">
              <p>购物车</p>
            </NuxtLink>
          </li>
          <li :class="{current:routePath=='/home/user'}">
            <NuxtLink to="/home/user">
              <img src="@/assets/img/home/f_user_0.svg" class="check">
              <img src="@/assets/img/home/f_user_1.svg">
              <p>会员中心</p>
            </NuxtLink>
          </li>
        </ul>
      </div>
    </div>
  </el-affix>
</template>
<script setup lang="ts">
const route = useRoute();
let routePath=ref(route.path)
watch(
  () => route.path,
  async (first: any, second: any) => {
    routePath.value = route.path
  },
  { immediate: true, deep: true }
);
const activeIndex = ref("");
</script>
<style scoped lang="scss">
.p-footer {
  height: 54px;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  background: #fff;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  ul {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    li {
      width: 25%;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 12px;
      height: 54px;
      .check{
        display: none;
      }
      &.current{
        img{
          display: none;
        }
        .check{
          display: block;
        }
        a{
          color: $mainColor;
        }
      }
      a {
        display: block;
        flex: 1;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        padding-top: 5px;
      }
      img {
        width: 20px;
        height: 20px;
        margin-bottom: 2px;
      }
    }
  }
}
</style>
