<template>
  <div class="default-width text-center mb-6">
    <span class="mr-2">{{ $t('position.popularPosition') }}:</span>
    <v-btn v-for="(item, index) in jobs" :key="index" size="small" class="ml-2 my-1" 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/personal/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>
</style>