primevue-mirror/components/lib/baseicon/BaseIcon.vue

46 lines
1.1 KiB
Vue

<script>
import BaseComponent from 'primevue/basecomponent';
import BaseIconStyle from 'primevue/baseicon/style';
import { ObjectUtils, UniqueComponentId } from 'primevue/utils';
export default {
name: 'BaseIcon',
extends: BaseComponent,
props: {
label: {
type: String,
default: undefined
},
spin: {
type: Boolean,
default: false
}
},
style: BaseIconStyle,
methods: {
pti() {
const isLabelEmpty = ObjectUtils.isEmpty(this.label);
return {
...(!this.isUnstyled && {
class: [
'p-icon',
{
'p-icon-spin': this.spin
}
]
}),
role: !isLabelEmpty ? 'img' : undefined,
'aria-label': !isLabelEmpty ? this.label : undefined,
'aria-hidden': isLabelEmpty
};
}
},
computed: {
pathId() {
return UniqueComponentId('pv_icon_clip_pv_id_');
}
}
};
</script>