UNPKG

str2avatar

Version:

convert string to avatar[image] with background

30 lines (23 loc) 597 B
```shell npm install str2avatar ``` ### [Online Demo](https://stackblitz.com/edit/vue-hkqrjw?file=src/App.vue) ```html <template> <input type="text" v-model="nickname"> <img :src="avatr" alt=""> </template> ``` ```javascript import { ref, computed } from 'vue'; import str2avatar from 'str2avatar' const nickname = ref('') const avatr = computed(() => str2avatar(nickname.value)) ``` ### str2avatar params is **object** or **string**; the struct is below while params is **object** - nickname - size - color <br /> + **nickname** is required + **size** and **color** is optional