Skip to content

Tag: vue.js

In Vue3 changing root state stopped working

My mutations which changes root state stopped working But changing inner value is working Answer This state = … changes state local variable (parameter), it cannot affect anything that happens outside this function. { …state, …payload } shouldn’t be done in Vue because it doesn’t…

Vue click event not emitting properly to div

As shown in the code, I want to get a click event to trigger the pop up ‘add-day-form’ which is a component. But by putting the @click=”showModal = true” in the wrapping div, when the pop up appears I cannot seem to press the close button that emits the close event. I only get it to cl…

Define global variables to use inside components

I have a Laravel 8 project, with vue-sweetalert2 installed. I’d like to define the Toast behaviour once, and then call it inside my components. By now I have this code: /js/components/Mypage.vue This works fine, of course, but as you can see Toast is defined inside the method, and I cannot re-use it som…

How to filter array with multiple conditions in Vuejs?

I am trying to achieve functionality like, Initially the array will be loaded with the help of v-for. At the top I have two options called search-bar and dropdown. Where With the help of those I am trying to filler the array. Where with search-bar, I want to filter array values. With dropdown, I want to filte…

How to make Provide and Inject Reactive in Vue?

I am trying to pass data using provide and inject but the injected data is not reactive, can any help me to make it reactive. I am changing the ‘ParentName’ after 3 sec using mounted hook’ In child component, i am injecting the value But I am getting the injected name as ‘Initial Value…