mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-15 16:02:19 +08:00
feat: convert iconItemSelect component to compositionAPI
This commit is contained in:
parent
9f95a64582
commit
af2e8b389b
@ -18,34 +18,40 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang="ts" setup>
|
||||
// 图标按钮选择组件
|
||||
const NAME = 'icon-item-select'
|
||||
// const NAME = 'icon-item-select'
|
||||
|
||||
export default {
|
||||
name: NAME,
|
||||
props: {
|
||||
label: {
|
||||
default: '',
|
||||
},
|
||||
data: {
|
||||
required: true,
|
||||
type: Array,
|
||||
},
|
||||
},
|
||||
emits: ['finish'],
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
selectItem(item) {
|
||||
type TPropData = {
|
||||
select: boolean,
|
||||
extraIcon: boolean,
|
||||
tip: string
|
||||
icon?: string
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
this.$emit('finish', item)
|
||||
},
|
||||
},
|
||||
emit('finish', item)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
Loading…
x
Reference in New Issue
Block a user