mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-24 15:51:04 +00:00
34 lines
803 B
TypeScript
34 lines
803 B
TypeScript
// Copyright 2017-2022 @polkadot/vue-identicon authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import * as jdenticon from 'jdenticon';
|
|
import Vue from 'vue';
|
|
|
|
interface Data {
|
|
svgHtml: string;
|
|
}
|
|
|
|
/**
|
|
* @name Jdenticon
|
|
* @description The substrate default via Jdenticon
|
|
*/
|
|
export const Jdenticon = Vue.extend({
|
|
created: function (): void {
|
|
this.createSvgHtml();
|
|
},
|
|
data: function (): Data {
|
|
return {
|
|
// eslint-disable-next-line quotes
|
|
svgHtml: `<svg viewBox="0 0 64 64" />`
|
|
};
|
|
},
|
|
methods: {
|
|
createSvgHtml: function (): void {
|
|
this.svgHtml = jdenticon.toSvg((this.publicKey as string).substr(2), this.size as number);
|
|
}
|
|
},
|
|
props: ['publicKey', 'size'],
|
|
// eslint-disable-next-line quotes
|
|
template: `<div v-html="svgHtml" />`
|
|
});
|