<template>
  <div>
    <a-button v-for="item in list" :key="item.id" @click="goHome(item.id)">
      {{ item.title }}
    </a-button>
    <a-button @click="goHome('')"> 后台管理 </a-button>
  </div>
</template>
<script setup lang="ts">
  import { useUserStore } from '@/store/modules/user';
  import { getSpecialData } from '@/api/demo/system';
  import { onMounted, ref } from 'vue';

  const list: any = ref([]);
  const userStore = useUserStore();
  async function getData() {
    const res = await getSpecialData();
    console.log(res);
    list.value = res;
  }
  onMounted(() => {
    getData();
  });
  async function goHome(name) {
    console.log(name);
    userStore.setSubject(name);
  }
</script>
<style lang="scss" scoped></style>
