<template>
  <div class="box text-center default-width">
    <span class="mr-2">热门职位:</span>
    <v-btn v-for="(item, index) in jobs" :key="index" size="small" class="ml-2 mb-2" color="primary" variant="tonal" @click="handleClick(item)">{{ item.nameCn }}</v-btn>
  </div>
</template>

<script setup>
import { getHotPositionList } from '@/api/common/index'
import { useRouter } from 'vue-router'
import { ref } from 'vue';
defineOptions({ name:'personal-hotJobs-list'})
const router = useRouter()


const handleClick = (item) => { router.push({ path: '/recruit/position',query: item }) }

// 获取行业树形
let jobs = ref(null)
const getTreeData = async () => {
  const res = await getHotPositionList()
  jobs.value = res.splice(0, 10) || []
}
getTreeData()
</script>

<style lang="scss" scoped>
.box {
  margin-bottom: 24px;
}
</style>