Refactor #3965 - For Chip

pull/3997/head
Tuğçe Küçükoğlu 2023-05-25 17:42:11 +03:00
parent 78954bcc45
commit 5296fc2bd3
2 changed files with 5 additions and 5 deletions

View File

@ -33,9 +33,9 @@ const classes = {
'p-chip-image': props.image != null
}
],
icon: ({ props }) => ['p-chip-icon', props.icon],
icon: 'p-chip-icon',
label: 'p-chip-text',
removeIcon: ({ props }) => ['p-chip-remove-icon', props.removeIcon]
removeIcon: 'p-chip-remove-icon'
};
const { load: loadStyle } = useStyle(styles, { id: 'primevue_chip_style', manual: true });

View File

@ -3,18 +3,18 @@
<slot>
<img v-if="image" :src="image" v-bind="ptm('image')" />
<component v-else-if="$slots.icon" :is="$slots.icon" :class="cx('icon')" v-bind="ptm('icon')" />
<span v-else-if="icon" :class="cx('icon')" v-bind="ptm('icon')" />
<span v-else-if="icon" :class="[cx('icon'), icon]" v-bind="ptm('icon')" />
<div v-if="label" :class="cx('label')" v-bind="ptm('label')">{{ label }}</div>
</slot>
<slot v-if="removable" name="removeicon" :onClick="close" :onKeydown="onKeydown">
<component :is="removeIcon ? 'span' : 'TimesCircleIcon'" tabindex="0" :class="cx('removeIcon')" @click="close" @keydown="onKeydown" v-bind="ptm('removeIcon')"></component>
<component :is="removeIcon ? 'span' : 'TimesCircleIcon'" tabindex="0" :class="[cx('removeIcon'), removeIcon]" @click="close" @keydown="onKeydown" v-bind="ptm('removeIcon')"></component>
</slot>
</div>
</template>
<script>
import BaseChip from './BaseChip.vue';
import TimesCircleIcon from 'primevue/icons/timescircle';
import BaseChip from './BaseChip.vue';
export default {
name: 'Chip',