Skip to main content

All Questions

1 vote
4 answers
4k views

Why doesn't the component tag in Vue3 work properly for dynamically rendering components?

I'm just learning Vue and trying to learn dynamic rendering using the component tag. What is the problem with this code? No errors are displayed in the console, but clicking on the buttons still does ...
mrcrazyog's user avatar
57 votes
4 answers
116k views

How can I use async/await in the Vue 3.0 setup() function using Typescript

(This question has been answered for JavaScript, see below, but this question is specific for TypeScript, which behaves differently) I'm trying to use async functionality in Vue3.0 using typescript. ...
Hendrik Jan's user avatar
  • 4,908
30 votes
2 answers
33k views

How to use <component :is=""> in vue 3 script setup

I am using the experimental script setup to create a learn enviroment. I got a selfmade navigation bar with open a single component. I am having trouble using the <component :is="" /> ...
wittgenstein's user avatar
  • 4,550
105 votes
8 answers
135k views

How to use props in <script setup> in vue3

Just like the title says, related Links: New script setup (without ref sugar) <template> <TopNavbar title="room" /> <div> {{ no }} </div> </template> ...
Molingran's user avatar
  • 1,232
33 votes
4 answers
21k views

How to use render function in <script setup> Vue3

I use Vue 3.1.1 I am using script setup in the experimental stage with single file components. Using the script setup, I understand defineProps, defineEmit, and useContext, but I don't understand how ...
user16184922's user avatar
27 votes
4 answers
48k views

How to use v-model on component in vue 3 script setup

I want to add a v-model on a component but I got this warning: [Vue warn]: Component emitted event "input" but it is neither declared in the emits option nor as an "onInput" prop. ...
wittgenstein's user avatar
  • 4,550
60 votes
5 answers
148k views

Vue Composition API: Defining emits

When defining custom events Vue encourages us to define emitted events on the component via the emits option: app.component('custom-form', { emits: ['inFocus', 'submit'] }) Using Vue 3's ...
PeterB's user avatar
  • 2,329
26 votes
3 answers
23k views

Calling method on Child Component - Composition API

I have a parent component where I need to call a method that exists in one of its child components: <template> <div> <button @click="callChildMethod"> <child-...
Deric Lima's user avatar
  • 2,102
26 votes
1 answer
51k views

Best way to get current route in Vue3 and Vue-router?

I am trying to get the current path (something like "https://example.com/some/path") with Vue3 and Vue-router. Before, when using Vue2, I could get the current route using: // works with ...
Hendrik Jan's user avatar
  • 4,908
36 votes
2 answers
91k views

How does Computed work in Vue 3 script setup?

I'm trying to get computed to work in <script setup>: <template> <div> <p>{{ whatever.get() }}</p> </div> </template> <script setup> import {...
Artur Müller Romanov's user avatar
32 votes
2 answers
57k views

Vuejs 3 emit event from child to parent component

I've recently started working with VueJS, I'm using v3 and seem to be having an issue calling a method on a parent. The emit function in the child doesn't seem to be emitting the event and nothing is ...
Keith Darragh's user avatar
31 votes
4 answers
17k views

How to define `name` and `inheritAttrs` in `<script setup>`?

Options API: <script> import { defineComponent } from 'vue' export default defineComponent({ name: 'CustomName', // 👈 inheritAttrs: false, // 👈 setup() { return {} },...
Wenfang Du's user avatar
  • 11.5k
24 votes
3 answers
20k views

Use props in composables vue3

I am upgrading an app from vue 2 to vue 3 and I am having some issues with composables. I'd like to use props in the composable but it doesn't seem to be working. The code sample is pulled from a ...
whoacowboy's user avatar
  • 7,477
9 votes
2 answers
24k views

Uncaught TypeError: emit is not a function in vue3

when I write this code in vue 3 setup code block to get the input value follow this answer, this is part of the code: import { defineComponent } from "vue"; import { defineProps, defineEmits ...
spark's user avatar
  • 1,163
6 votes
2 answers
7k views

Watch child properties from parent component in vue 3

I'm wondering how I can observe child properties from the parent component in Vue 3 using the composition api (I'm working with the experimental script setup). <template>//Child.vue <button ...
wittgenstein's user avatar
  • 4,550

15 30 50 per page