<template>
  <div>
    <Nav title="我的关注"> </Nav>
    <div class="list">
      <AttentionItem
        v-for="(item, index) in tgList"
        :key="index"
        :item="item"
        @deleteTg="deleteTg"
      />
      <Empty text="暂无内容" v-if="!tgList.length" />
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import Nav from "@/components/NavBar.vue";
import AttentionItem from "./components/AttentionItem.vue";
import { getFollowTgList } from "@/api/index";
import Empty from "@/components/Empty.vue";
// 获取投顾列表
const tgList = ref([]);
const getTgList = async () => {
  let ret = await getFollowTgList();
  if (ret.code === 0) {
    tgList.value = ret.data;
  }
};
getTgList();

const deleteTg = (id) => {
  tgList.value = tgList.value.filter((item) => item.id !== id);
};
</script>
<style scoped lang="scss">
.list {
  padding: 0 32px;
}
</style>
