108,131 questions
1
vote
1
answer
54
views
Vue 2 + Composition API + vue-test-utils 1.3.6: `Cannot redefine property` and `setProps` doesn’t trigger `watchers`
Problem:
I’m migrating a Vue 2.6 app to the Composition API (via the plugin) and hit two testing issues with vue-test-utils (v1) + Jest:
Jest couldn’t mock functions from a plain TS module (not a Vue ...
371
votes
14
answers
427k
views
Can I pass parameters in computed properties in Vue.Js
is this possible to pass parameter in computed properties in Vue.Js. I can see when having getters/setter using computed, they can take a parameter and assign it to a variable. like here from ...
2
votes
0
answers
48
views
How can I use the input search in a different component using Algolia/Vue
I am using the infinite scroll with Vue 3 and InstantSearch(Algolia) but the
<ais-search-box placeholder="Search here…" class="searchbox" />
it should be in a different ...
371
votes
16
answers
227k
views
Vue.js - How to remove hashbang #! from url?
How to remove hashbang #! from url?
I found option to disable hashbang in vue router documentation ( http://vuejs.github.io/vue-router/en/options.html ) but this option removes #! and just put #
Is ...
137
votes
18
answers
223k
views
VSCode showing "cannot find module" TS error for .vue import while compiling doesn't
Simply put, vscode is showing this error in a module:
Cannot find module '@/components/SidebarToggleIcon'
But no such error shows up during compilation.
This is a VueJS project and SidebarToggleIcon ...
1
vote
0
answers
159
views
How to set up a responsive layout that wraps based on content width/wrapping instead of css breakpoints?
I have a vue.js component with a toolbar that contains three sections: actions, filters, and search with buttons. The current implementation uses CSS breakpoints to control layout ordering, but this ...
0
votes
1
answer
56
views
Why do I see only some icons as icons in VS Code?
When writing a Vue.js component, the following code:
const mealIcon = (meal: string): string => {
switch (meal) {
case "lunch": return 'ic:outline-lunch-dining'
case "...
0
votes
0
answers
56
views
Heroku build failed Outdated Yarn lockfile
I inherted an app that was delpoyed on heroku with a git repo with a ruby backend and vue.js front end. I am completly at a loss trying to figure this matter out the backend depolyed perfectly but i ...
0
votes
0
answers
30
views
Can we make a vertical InputGroup in PrimeVue?
PrimeVue offers a convenient way to work with an InputGroup, like:
<InputGroup>
<InputGroupAddon>
<i class="pi pi-user"></i>
</InputGroupAddon>
...
2
votes
1
answer
191
views
A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function
I'm getting this error when I use useNewSession.ts composable in my Nuxt middleware.
[nuxt] A composable that requires access to the Nuxt instance was called
outside of a plugin, Nuxt hook, Nuxt ...
235
votes
19
answers
247k
views
How to implement debounce in Vue2?
I have a simple input box in a Vue template and I would like to use debounce more or less like this:
<input type="text" v-model="filterKey" debounce="500">
However ...
1
vote
1
answer
55
views
404 in DevTool Console for website on AWS Amplify/Vue
I’m running into an issue with my AWS Amplify-hosted website, which is built using Vue 3 and Vite.
When I load the main page (e.g., https://url.de/) and navigate to sub-pages (e.g., https://url.de/...
259
votes
17
answers
542k
views
How to set URL query params in Vue with Vue-Router
I am trying to set query params with Vue-router when changing input fields, I don't want to navigate to some other page but just want to modify URL query params on the same page, I am doing this:
this....
263
votes
16
answers
90k
views
What is the difference between the views and components folders in a Vue project?
I just used the command line (CLI) to initialize a Vue.js project. The CLI created a src/components and src/views folder.
It has been a few months since I have worked with a Vue project and the ...
0
votes
3
answers
2k
views
Adding TailwindCSS association to Vue/Svelte/Astro file to disable "css(unknownAtRules): Unknown at rule @apply"
I want to associate TailwindCSS syntax interpretation with .vue (or Svelter / Astro) files so that the VSCode doesn't show errors for TailwindCSS directives in the <style> section, which would ...
0
votes
1
answer
227
views
Toaster from shadn/Sonner it is not shown
I'm working in a Vue monorepo with a custom UI package. I want to use the Sonner toast component (vue-sonner v2) following the official shadcn-vue guide. I've set everything up without any import ...
146
votes
10
answers
127k
views
'v-slot' directive doesn't support any modifier
I am using Vuetify's datatable, we have different slots with some props for example below
<template #header.data-table-select="{ on, props }">
<v-simple-checkbox color="...
346
votes
17
answers
388k
views
Call a Vue.js component method from outside the component
Let's say I have a main Vue instance that has child components. Is there a way of calling a method belonging to one of these components from outside the Vue instance entirely?
Here is an example:
...
-2
votes
1
answer
73
views
Replace leading minus with trailing BCE
I'm not able to use the date module in my CMS because of the historic dates (many are before the common era), I want to use numbers (this provides me with a correct sorting of the items); so when I ...
302
votes
13
answers
163k
views
Methods vs Computed in Vue
What is the main difference between a method and a computed value in Vue.js?
They seem the same and interchangeable to me.
0
votes
1
answer
97
views
Tailwind layer classes added twice
After updating from Tailwind v3 to v4, some Tailwind layer classes are added twice causing unwanted overrides, for example when I inspect element's computed styles in Chrome:
The redundant .text-...
249
votes
12
answers
301k
views
Vuejs: Event on route change
On my main page I have dropdowns that show v-show=show by clicking on the link @click = "show=!show" and I want to set show=false when I change the route. Please advise me on how to realize ...
197
votes
17
answers
149k
views
Only show slot if it has content
Is there a way to only display a slot if it has any content?
For example, I'm building a simple Card.vue component, and I only want the footer displayed if the footer slot has content:
Template
<...
0
votes
2
answers
222
views
How to implement HSTS (Strict-Transport-Security) in a Vue.js SPA hosted on Azure App Service?
I have a Single Page Application (SPA) built with Vue.js and deployed to Azure App Service (Linux). This app communicates with a backend .NET Web API, also deployed to Azure App Service.
I've ...
215
votes
14
answers
407k
views
Using Environment Variables with Vue.js
I've been reading the official docs and I'm unable to find anything on environment variables. Apparently there are some community projects that support environment variables but this might be overkill ...