Skip to content

Tag: vuejs3

Vue 3 Append Component to the DOM: Best Practice

I would like to dynamically create a component in my Vue 3 app that I have in an SFC, and append it to the DOM. I am using <script setup> style components, which is yet another wrinkle. This seems unnecessarily hard. Here’s more or less what I want to do: Fetch some data. Got that. Make an instanc…

Vue 3 defineEmits breaks defineProps types

I’m using Vue 3 and TS 4.4. I’ve got a component that defines its prop types with defineProps. When I add a call to defineEmits, VS Code starts telling me my props variable doesn’t exist in the component template. Here’s the source code: And a couple of screenshots to better show what …

Add CSS to Vue using JavaScript

I am trying to add style to this <label> tag on Vue. I want that when the onPrimaryPicSelected function is called to add a CSS styling to the <label> tag. How can I do this if it is possible? Currently the onPrimaryPIcSelected just gets the image that was uploaded. Answer You can use a boolean var…