feat: convert iconItemSelect component to compositionAPI

This commit is contained in:
IchliebedichZhu 2024-03-08 15:04:30 +00:00
parent 9f95a64582
commit af2e8b389b

View File

@ -18,34 +18,40 @@
</div> </div>
</template> </template>
<script> <script lang="ts" setup>
// //
const NAME = 'icon-item-select' // const NAME = 'icon-item-select'
export default { type TPropData = {
name: NAME, select: boolean,
props: { extraIcon: boolean,
label: { tip: string
default: '', icon?: string
},
data: {
required: true,
type: Array,
},
},
emits: ['finish'],
data() {
return {}
},
methods: {
selectItem(item) {
if (typeof item.select !== 'undefined') {
item.select = !item.select
}
this.$emit('finish', item)
},
},
} }
type TProps = {
label?: string
data: TPropData[]
}
type TEmits = {
(event: 'finish', data: TPropData): void
}
const props = withDefaults(defineProps<TProps>(), {
label: ''
})
const emit = defineEmits<TEmits>()
function selectItem(item: TPropData) {
if (typeof item.select !== 'undefined') {
item.select = !item.select
}
emit('finish', item)
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>