Refactor #3965 - For Chip
parent
78954bcc45
commit
5296fc2bd3
|
@ -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 });
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue