vue-script-setup Questions
4
Solved
New to Vue in general and currently using 3.2.37, I possibly missunderstood the correct usage of composition api’s defineExpose directive as documented here: https://vuejs.org/api/sfc-script-setup....
Sst asked 13/8, 2022 at 13:38
4
Solved
I'm facing an error with vue3, ts, vue cli where it says
Module '"c:/Users/USER/Documents/top-secret-project/src/components/Features/Features.vue"' has no default export.
when importing a...
Neap asked 27/8, 2022 at 16:49
2
Solved
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="" /&g...
Torp asked 26/2, 2021 at 10:40
6
The export default statement does not seem to work inside <script setup>.
If I try to export it in test.vue:
<template>
<div id="test" class="test">
</di...
Vodka asked 6/3, 2022 at 7:3
4
Solved
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" pro...
Splashdown asked 21/3, 2021 at 21:48
8
Solved
How to add a global variable in Vue.js 3?
In Vue.js 2 we use this in the main.js file:
Vue.prototype.$myGlobalVariable = globalVariable
Othilie asked 26/7, 2020 at 13:16
4
Solved
(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...
Calamondin asked 29/9, 2020 at 9:50
2
Solved
Is there a way to break/return from Vue3 <script setup>?
<script setup lang="ts">
// code is not working, for illustration purpose
if (!process.client) return
// do someth...
Saltant asked 8/3, 2022 at 19:57
2
As per the official documentation,
defineProps and defineEmits are compiler macros only
usable inside <script setup>. They do not need to be
imported and are compiled away when <script se...
Dissert asked 28/9, 2021 at 18:38
3
Solved
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 w...
Wilona asked 27/5, 2022 at 16:30
2
Solved
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 ...
Keening asked 30/10, 2020 at 9:34
3
Solved
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-compo...
Exculpate asked 18/11, 2020 at 8:48
8
Solved
Just like the title says,
related Links:
New script setup (without ref sugar)
<template>
<TopNavbar title="room" />
<div>
{{ no }}
</div>
</template>
&l...
Jorgejorgensen asked 26/2, 2021 at 8:16
4
Solved
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 h...
Pyrogallate asked 10/6, 2021 at 9:23
3
I'm trying to replicate this, only with <script setup> tag which doesn't have this keyword.
Template (from code that I'm trying to replicate)
<swiper ref="swiper">
<swiper...
Unsearchable asked 19/5, 2022 at 0:18
5
Solved
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 composit...
Polyhedron asked 22/1, 2021 at 11:36
1
Solved
This seems like a basic question, but I'm not having luck finding someone posting about it.
Using Vue3 with script setup
Goal:
TLDR: I'm trying to use a child type definition to type one key of an ...
Hook asked 3/10, 2022 at 13:16
2
I want to access the "name" variable from <script> in my <script setup> block. I cant seem to figure out how to do it. I have tried importing options from '*.vue' but that pro...
Amaral asked 10/8, 2022 at 15:20
3
Solved
As it mentions here all the top level bindinigs introduced in script setup are exposed to template.
Question: How to exclude some of them? Something like private vairables which are only available ...
Brittbritta asked 19/9, 2022 at 10:44
6
Solved
I'm refactoring component from regular Vue 3 Composition API to Script Setup syntax. Starting point:
<script lang="ts">
import { defineComponent, computed } from 'vue';
import { map...
Rosemari asked 22/9, 2020 at 12:47
4
Solved
Options API:
<script>
import { defineComponent } from 'vue'
export default defineComponent({
name: 'CustomName', // 👈
inheritAttrs: false, // 👈
setup() {
return {}
},
})
</scrip...
Catatonia asked 8/5, 2021 at 8:39
3
Solved
I have a child component called Navbar. A logout is an option in the Navbar.
<a @click="(event) => {event.preventDefault();}">
Logout
</a>
I have imported this Navbar in...
Kansas asked 25/7, 2022 at 7:22
1
Solved
I am using a composable to load images in Vue3. I have been able to pass all the props successfully as one object, see this question, but I am unable to pass the one property I want to be reactive....
Demimonde asked 27/5, 2022 at 18:54
2
Solved
We all love vue 3 new script setup, but it is difficult to shift to it because of low usage and less support. I faced problem while getting and using props value inside functions.My code was like b...
Pumpkin asked 4/5, 2022 at 7:0
1
I am new to Vue3 and am struggling with some examples. I have a simple login component that should redirect to another page but isn't.
Here is my template:
And here is my script:
The problem is t...
Mcmurray asked 14/4, 2022 at 1:39
1 Next >
© 2022 - 2024 — McMap. All rights reserved.