<template>
  <div class="box text-center">
    <span class="mr-2">热门职位:</span>
    <v-btn v-for="(item, index) in jobs" :key="index" size="small" class="ml-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 || []
  // // 暂无数据，先假数据
  // if (!res?.length) jobs.value = ['Java','PHP','C#','.NET','会计','区块链工程师','测试', '新媒体运营','人力资源专员/助理','GIS工程师']
}
getTreeData()
</script>

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