I am testing some Vue 3 components with jest and expect to get an emit when a button is clicked. Now I want to check if the object emitted matches a custom type I created in a different file. e.g.: My test case looks something like this: But here I get the error Element is not accessible at customType even
Tag: vue.js
Vue-Router URL from external source always redirects to “/”
I am running Vue 2 directly off the Vue dev server. I am trying to enter a vue route (vue-router) from an external url. For some reason I don’t know, vue-router always redirects my request and handles it as if it comes from “/”, which automatically redirects to “/login” I found a similiar questions here (https://forum.vuejs.org/t/access-to-a-vue-route-from-external-link/107250) but there is no
How can i filter records from proxy in VUE3?
I am using ref() to store data from firebase. But when I am trying to filter and get the single record. It looks something like the below. But it is not supposed to. I should return a single object. Below is my code, Please guide me where i am wrong. Answer In Vue 3, ref() performs a deep reactive operation
Getting JSON object from a arraylist
I have specific problem with axios to getting JSON object from my arraylist, so instead of display my displayName on my nav bar, it display all response headers information, i don’t know why ? : that my json list from my localhost : that my code : Answer Take a look at the axios docs. The response object contains much
scrollTop using computed in vue.js
Here is part of my code The button doesn’t disappear when i scroll the page to the top. Answer You need to listen to scroll event, try like following snippet:
Vuejs : how to bind class within a v-for loop
In Vuejs3, I’m looping over an array of objects : I want to add the class ‘border-b-2’ only to the line selected line, but I don’t see how to do that dynamically. When I now set isSelected to true in the vue devtools, all lines get that style applied. As a workaround, what I now do is wrapping this code
How to prevent user from entering value below 1 in Vue 3 number input
I am attempting to set up a number input field in Vue 3 that prevents the user from entering a value below 1. So far I have the following input with min = 1 to prevent clicking the input arrows below 1: However, the user can still manually enter 0 or a negative number. How can I prevent the user
How to use placeholder in select box if it is created with v-for?
Update: Due to my own fault of not mentioning, that tool is created in a v-for loop during render, I couldn’t apply the proposed answers although they might have been correct. In the end I did a workaround by adding following css sudo element to the parent of the select element: and setting it to display: none, when an item
get array of object value and nested array of object value
I’ve this nested array of object array: How can I get the ids base on selected property? I manage to get the first level, I’ve tried but how can I select the ids which is in the subItems? I expect the result to be [1, ‘2a’, 3] Answer Flatten the array first. Be careful of using && item.id inside the
Property or method “_” is not defined on the instance but referenced during render
Im a capable react developer, but have inherited a vue.js project from another developer and have maintained it for several years now, unfortunately I haven’t gone through much personal effort to learn vue as i should. I have a strange error being thrown from using lodash, I believe it doesnt like my _.debounce call Component: console.error Answer Accessing _ in