You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<template>
|
|
|
|
<div v-html="generateIcon()" class="w-fit"></div>
|
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { createAvatar, StyleOptions } from "@dicebear/core";
|
|
|
|
import { avataaars } from "@dicebear/collection";
|
|
|
|
import { Vue, Component, Prop } from "vue-facing-decorator";
|
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class EntityIcon extends Vue {
|
|
|
|
@Prop entityId = "";
|
|
|
|
@Prop iconSize = 0;
|
|
|
|
|
|
|
|
generateIcon() {
|
|
|
|
const options: StyleOptions<object> = {
|
|
|
|
seed: this.entityId || "",
|
|
|
|
size: this.iconSize,
|
|
|
|
};
|
|
|
|
const avatar = createAvatar(avataaars, options);
|
|
|
|
const svgString = avatar.toString();
|
|
|
|
return svgString;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped></style>
|