<template>
  <commonStyle btnTitle="求职类型" :close-on-content-click="false">
    <v-list>
      <v-list-item
        color="primary"
        :active="selectedItems.includes(item.value)"
        v-for="item in items" :key="item.id" :value="item.value"
        @click="handle(item.value)"
      >
        <v-list-item-title>{{ item.label }}</v-list-item-title>
      </v-list-item>
    </v-list>
  </commonStyle>
</template>
<script setup>
import commonStyle from './commonStyle.vue'
import { getDict } from '@/hooks/web/useDictionaries'
import { ref, defineEmits } from 'vue';

defineOptions({name: 'conditionFilter-JobType'})
const emits = defineEmits(['selectedItems'])
let items = ref()
const selectedItems = ref([])
getDict('menduner_job_type').then(({ data }) => {
  data = data?.length && data || []
  items.value = data
})
const handle = (val) => {
  if (selectedItems.value.includes(val)) selectedItems.value = selectedItems.value.filter(i => i !== val)
  else selectedItems.value.push(val)
  emits('selectedItems', selectedItems.value)
}
</script>
<style lang="scss" scoped>
</style>
