I have this data’s is there a way to get all of these? already tried this._data.forEach but it is not working thanks! Answer Vue uses underscore as a prefix for its internal properties. You should avoid using them. The data object for an instance is accessible via the $data property. https://v2.vuejs.org/v2/api/#vm-data So within an instance you can get that object
Tag: javascript
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
Nuxt.js i18n localization doesn’t work in SPA mode
I developed project Nuxt.js in universal mode and localized with i18n work fine, but now I want to change to in spa mode but i18n doesn’t change the language. this is code. file : nuxt.config.js file : middleware/i18n.js store/index.js and licalize file are in locales/fa.json and en.json Answer export default function ({ isHMR, app, store, route, params, req, error, redirect
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
While loop to print vowels and other elements on a new line in JavaScript
Trying to print any vowels from a word on a new line in the order they appear. Then do the same for each constant after all the vowels have been printed. I’ve tried using breaks and a switch case but the code wouldn’t work. I expect an output to be like: Then the consonants in the order they appear: Answer
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
How to test if component counts array length properly with Jest
I have a component that I am giving an array with objects as props to it like this: How can I test that the provided array has the correct length, for example if there are two objects in the array, the component should return two, if there is one, one, if there are none then it should return 0, how
Reading excel file into array using javascript
I’m trying to read an excel file and create a multidimensional array in javascript with it. The excel file will look like: I need it to create an array that looks like: So far, I’ve been able to bring up a file selection window, and I believe it’s reading the file, I just think it might not be putting the
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,