I am changing my application from vue 2 to vue 3. By using composition api,i have changed my previous render function in that setup hook. After checking some documentation,I got to know that i can expose methods by using context.expose({}). Now my questions are: How to replace created method in vue 3 composition api? (As we know, setup hook occurs
Tag: vue-component
How can i set focus on a newly (automatically) rendered dom element?
I have an input field that gets replaced automatically with a textarea and same content depending on the number of characters the user has entered: The problem i have is that the focus gets lost when a user enters the 21st character. And thus the user gets irritated because when he types the 22nd character it does not appear in
How to remove event listener from Vue Component
I have a Vue2 component which contains an added eventListener i created on mounted. I was wondering how do i properly remove this listener when the component is destroyed? Answer You can use this.$el for whole component and destroy event like you created it:
button function to sum of two numbers using Vuejs
I’m trying to display the sum of two numbers using VueJs, but I want to develop this code so it would get the sum when the user clicks the button. please help me! Answer
Vuejs : rendering dynamic link in a button base on probs
I have a create button above my table, I’m trying to render dynamic :to v-bind Since I have access to {{title}} Ex. {{title}} = apple, orange, any string I’ve tried I get Try #2 to=”{title}/create” link redirect wrong! http://localhost:8080/%7Btitle%7D/create Try #3 to=”{{title}}/create” crashed !! Answer vue-directives are ALWAYS wrapped with double-quotes, even if you are using template literal
Usage of asynchronous response data in asynchronous components
Below is the parent component and child component enter code here I want to draw a new chart whenever the $store(vuex) data changes. However, since the response of this data is asynchronous, when the child component is loaded, it may or may not have received the data(in Parent component). I always want to draw a chart with the data I
Hide element in VueJs while scrolling
I am making vue project. I want to hide some component while mouse scrolling, but when scroll ends, want to show component again. I know using scroll event, but again doesn’t shows component. Is this possible in vue? Answer I resolved this issue. timer variable is applied.
How to call component, after submit form success?
I have a page with a register form, after submit form and return response success, i need to call another component in the same page, without reload page, how to do this? Method post from form with response: Answer I assume you mean ‘reveal’ the component after response successful? You can try below: Then in js part:
This dependency was not found: *swiper/vue how to fix?
I’m scratching my head because I ran npm i swiper and read through the Swiper Vue docs and it says to import { Swiper, SwiperSlide } from ‘swiper/vue which I’ve done and I even get the bundle size showing 95.4K (gzipped: 28.9K). When I run npm run serve I then get this error I for the life of me cannot
How to combine each select tag’s data
I’m creating a sign-up page in vue3 now and trying to pass the value of birthDate. The date of birth consists of three select tags and each tag has a year, month, and day as an option. I want to combine the values of each select tags into birthDate. and need to deliver the value of the birthDate through ‘axios