primevue-mirror/components/lib/chip/BaseChip.vue

81 lines
1.4 KiB
Vue
Raw Normal View History

2023-05-24 07:39:02 +00:00
<script>
import BaseComponent from 'primevue/basecomponent';
import { useStyle } from 'primevue/usestyle';
const styles = `
2023-09-25 19:11:55 +00:00
@layer primevue {
.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%;
}
2023-05-24 07:39:02 +00:00
}
`;
const classes = {
root: ({ props }) => [
'p-chip p-component',
{
'p-chip-image': props.image != null
}
],
2023-05-25 14:42:11 +00:00
icon: 'p-chip-icon',
2023-05-24 07:39:02 +00:00
label: 'p-chip-text',
2023-05-25 14:42:11 +00:00
removeIcon: 'p-chip-remove-icon'
2023-05-24 07:39:02 +00:00
};
const { load: loadStyle } = useStyle(styles, { name: 'chip', manual: true });
2023-05-24 07:39:02 +00:00
export default {
2023-05-24 10:09:45 +00:00
name: 'BaseChip',
2023-05-24 07:39:02 +00:00
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,
loadStyle
2023-05-24 07:39:02 +00:00
},
provide() {
return {
$parentInstance: this
};
2023-05-24 07:39:02 +00:00
}
};
</script>