<template>
  <div>
    <van-tabbar v-model="active" placeholder safe-area-inset-bottom active-color="#f0896e">
      <van-tabbar-item v-for="(item,index) in list" :key="index">
        <span>{{item.text}}</span>
        <template #icon="props">
          <img :src="props.active ? item.selectedIconPath : item.iconPath" />
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>
export default {
  data() {
    return {
      active: 0,
      list: [
        {
          iconPath: require('../assets/images/nav/home-off.png'),
          selectedIconPath: require('../assets/images/nav/home-on.png'),
          text: '首页',
        },
        {
          iconPath: require('../assets/images/nav/book-off.png'),
          selectedIconPath: require('../assets/images/nav/book-on.png'),
          text: '老年课堂',
        },
        {
          iconPath: require('../assets/images/nav/map-off.png'),
          selectedIconPath: require('../assets/images/nav/map-on.png'),
          text: '养老服务圈',
        },
        {
          iconPath: require('../assets/images/nav/serve-store-off.png'),
          selectedIconPath: require('../assets/images/nav/serve-store-on.png'),
          text: '养老商城',
        },
        {
          iconPath: require('../assets/images/nav/my-off.png'),
          selectedIconPath: require('../assets/images/nav/my-on.png'),
          text: '我的',
        },
      ],
    }
  },
}
</script>