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

67 lines
1.4 KiB
Vue
Raw Normal View History

2023-03-31 21:45:03 +00:00
<script>
import { ObjectUtils } from 'primevue/utils';
export default {
name: 'BaseIcon',
props: {
label: {
type: String,
2023-04-26 08:57:02 +00:00
default: undefined
2023-03-31 21:45:03 +00:00
},
spin: {
type: Boolean,
2023-04-26 08:57:02 +00:00
default: false
2023-03-31 21:45:03 +00:00
}
},
methods: {
pti() {
const isLabelEmpty = ObjectUtils.isEmpty(this.label);
return {
class: [
'p-icon',
{
'p-icon-spin': this.spin
}
],
role: !isLabelEmpty ? 'img' : undefined,
2023-04-03 08:26:51 +00:00
'aria-label': !isLabelEmpty ? this.label : undefined,
2023-03-31 21:45:03 +00:00
'aria-hidden': isLabelEmpty
};
}
}
};
</script>
<style>
.p-icon {
display: inline-block;
}
.p-icon-spin {
-webkit-animation: p-icon-spin 2s infinite linear;
animation: p-icon-spin 2s infinite linear;
}
@-webkit-keyframes p-icon-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes p-icon-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
</style>