You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<scriptsetup>importvuefrom'./assets/vue.svg'// this is verboseconstwill_not_work='./assets/vue.svg'// this will not work</script>
<template>
<div>
<ahref="https://vuejs.org/"target="_blank">
<img :src=vue class="logo vue"alt="Vue logo" />
</a>
</div>
</template>
Here both options seems similar, but the problem is easier to spot when the image is nested on another structure and would never be named, in that case, this add a lot of noice:
importvueimgfrom'./assets/vue.svg'// this is verboseconstvue={img: vueimg,// instead of './assets/vue.svg'name: 'Vue',}
Is there a less verbose way to reference assets on the scripts, or may be it can be added?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
There is some magic that makes it easy to reference assets on templates, for example on this vue example:
But that magic does not work on the setup script:
Here both options seems similar, but the problem is easier to spot when the image is nested on another structure and would never be named, in that case, this add a lot of noice:
Is there a less verbose way to reference assets on the scripts, or may be it can be added?
Beta Was this translation helpful? Give feedback.
All reactions