How to load dynamic images from url in Nuxt3?
<p>I have a nuxt 3 component that cannot load a dynamic image that I get from a specific URL (auth0 image). </p>
<p>My template looks like this:</p>
<pre class="brush:php;toolbar:false;"><template>
<img class="h-28 w-28 rounded-full border-4 border-black bg-gray-300" :src="image" alt=" " />
<p> {{{name}} {{image}} </p>
</template></pre>
<p>My script is set up as follows:</p>
<pre class="brush:php;toolbar:false;"><script setup>
import { useAuth0 } from '@auth0/auth0-vue';
let auth0 = process.client ? useAuth0() : undefined;
let name = ref('');
let image = ref('');
//check user authentication state and set name and image
if(auth0?.isAuthenticated){
name.value = auth0?.user.value.nickname; //image url: https://....
image.value = auth0?.user?.value.picture;
}
</script></pre>
<p>The name and image appear in the paragraph, but the image url does not exist in the src attribute, so the image does not appear. When I go back and type something in VSCode, the image actually renders. Any idea how to render an image? </p>