createAvatar [object, object] in Vue. #156
-
I am trying to preview avatar but when I check img, src refers to [object, object]. I tried JSON.stringify() but did not work. Console.log gives the right URL with which I can get the desired avatar. The only problem is I cannot display the image of avatar as its src is [object, object]. |
Beta Was this translation helpful? Give feedback.
Answered by
FlorianKoerner
Sep 16, 2021
Replies: 1 comment 1 reply
-
Do you have a code example? Here's what works for me. But I'm not sure if this answers your question. <template>
<img alt="Avatar" v-bind:src="avatar">
</template>
<script>
import { createAvatar } from "@dicebear/avatars";
import * as style from "@dicebear/open-peeps";
export default {
name: "App",
computed: {
avatar: () => {
return createAvatar(style, {
dataUri: true,
size: 128
});
}
}
};
</script> CodeSandbox Example: |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Tomo5524
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you have a code example? Here's what works for me. But I'm not sure if this answers your question.
CodeSandbox Example:
https://codesandbox.io/s/dry-voice-x3wv5?file=/src/App.vue