Skip to content
Advertisement

Tag: vue.js

How to detect when vue component is after update function by property?

I need to display a spinner in vue for every component (this is the requirement). For that I think about to do v-if=”loading” inside component HTML. My question is how to detect when component is loading complete? (meaning after the DOM is rendered, and the data-bind is resolved to the DOM elements) According to Vue lifecycle when update function is

Export SASS/SCSS variables to Javascript without exporting them to CSS

Background Consider the following _variables.scss file: The purpose of the above code is to make the SCSS variables available to Javascript by means of importing like so: See a more detailed description here. The Problem Now consider the following template (I have used as Vue.js template as an example but this is relevant to numerous frameworks): In the above example

I want to add counter in for loop in each item.(vue.js)

I’m making cart app with Vue. And trying to make quantity counter, but when I click – or + button, all of items quantity also increase or decrease. So it seems like I need to give each key for buttons but I don’t know how to do that. Answer Your num variable shouldn’t be in your component and instead you

How to make routes case sensitive in Nuxt

I use nuxt.js + vue.js. I need to create case sensitivity of routers. I found the following property: caseSensitive. I’m trying to put it into nuxt.config but it doesn’t work, the transition is possible by links in upper case. If I directly change the file ~project/.nuxt/router.js, everything works correctly. Help me to figure it out. Answer Your code seems to

Error when trying to target and add classes to html, body, and __nuxt elements in Vue/Nuxt

I’m getting the error “cannot read property ‘classList’ of null” when trying to add/remove classes using document.getElementsByTagName(‘html’).classList, and also for any other high-level elements in the skies above Component Land, such as body or __nuxt. Running in mounted() lifecycle with nextTick function. Also tried checking process.client, but no luck either. Any ideas? Thanks : ) Answer From my comment above,

Problems getting data on event change vue and laravel

I’m having a hard time getting data from an event triggered by a change in a select, let me show you the code: This is the select: This is the method: This is the function in the controller: That’s the route: In payloads on Vue Developer Tools i get the values that i expect but still get the error: [Vue

In Vue, what parameters does createElement() actually get?

(This is a further question after this one: In Vue, what is the relationship of template, render, VNode?) Found createElement()’s source code (from here): Code main.js: (partly) App.vue: Questions A. In App.vue, export default {} will return an empty object, is that correct? B. In main.js: B-1. import App from ‘./App.vue’, will bind App to the empty object, is that

How to mock dispatch in vueJs testing

I am currently performing unit tests on my application as seen. But I have a problem. How to mock or exploit the dispatch of Vuex ? My method to test : My unit test : I have a error message : Dispatch is not a function. Why ? Do you help me please ? I don’t understand why I had

Advertisement