81 lines
1.4 KiB
Vue
81 lines
1.4 KiB
Vue
<script>
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
const styles = `
|
|
.p-chip {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.p-chip-text {
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.p-chip-icon.pi {
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.p-chip-remove-icon {
|
|
line-height: 1.5;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.p-chip img {
|
|
border-radius: 50%;
|
|
}
|
|
`;
|
|
|
|
const classes = {
|
|
root: ({ props }) => [
|
|
'p-chip p-component',
|
|
{
|
|
'p-chip-image': props.image != null
|
|
}
|
|
],
|
|
icon: 'p-chip-icon',
|
|
label: 'p-chip-text',
|
|
removeIcon: 'p-chip-remove-icon'
|
|
};
|
|
|
|
const { load: loadStyle } = useStyle(styles, { id: 'primevue_chip_style', manual: true });
|
|
|
|
export default {
|
|
name: 'BaseChip',
|
|
extends: BaseComponent,
|
|
props: {
|
|
label: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
icon: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
image: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
removable: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
removeIcon: {
|
|
type: String,
|
|
default: undefined
|
|
}
|
|
},
|
|
css: {
|
|
classes
|
|
},
|
|
watch: {
|
|
isUnstyled: {
|
|
immediate: true,
|
|
handler(newValue) {
|
|
!newValue && loadStyle();
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|