Is there an event in Vue that gets fired after an element re-renders? I have an object that updates, which causes my template to update. After it updates I want to trigger an event which runs a jQuery function. The code looks like this: As you see, I tried using the watch event, however when the watch event triggers, my
Tag: vuejs2
Vue-router error: TypeError: Cannot read property ‘matched’ of undefined
I’m trying to write my first Vuejs app. I’m using vue-cli and simple-webpack boilerplate. When I add vue-router links to my app component I get this error in console Error in render function: “TypeError: Cannot read property ‘matched’ of undefined” Here is my code: App.vue main.js routes.js Answer The name when you add it to Vue must be router. If,
Data object defined in created function but NOT reactive?
I have a Vue instance where data property is initialised as an object: And then when the instance is created I add a property to the obj. However, when I want to display the object’s object property count, it shows 0 and is not reactive. If I defined the whole object in the data, it is reactive but I can’t
Typecasting v-for key Vue
I am creating a v-for list based on a range that I am suppling my component: I am suppling my data as a prop like so: My v-for key will always be set as a string though when I log typeof. This is strange since I am passing an object which holds the key as a number and not a
How to format numbers in VueJS
I couldn’t find a way of formatting numbers in VueJS. All I found was the builtin currency filter and vue-numeric for formatting currencies, which needs some modification to look like a label. And then you can’t use it for displaying iterated array members. Answer Install numeral.js: Define the custom filter: Use it:
Vue, how do I pass data to component in render method
This is the main vue component. I want to make an ajax request and pass the data using the render method to my app component, which is a standalone component in a different file. How do I pass this data and how can I retrieve it in my app component. I am learning Vue, I know how to do this
Why is my v-for statement not reacting to Vue properly?
I have the following code with marker-popup defined here: pointsArray is updated here: However, it does nothing to affect the v-for statement. Whenever the addPoint() method runs, it alters pointsArray in one of two ways It pushes to the array – this works fine, v-for is perfect It changes an element in the array according to what the Vue.js docs
How do I communicate from a slot child definition to the containing component in vue 2.x?
I am writing a simple tooltip component. The contents of the tooltip are defined with a vue slot. I want the contents of the slot to be able to signal a close of the tooltip, the same way the tooltip can close itself from its own template. Here’s example code: Answer You could add a ref attribute to the vtip
Call method from component inside component’s
I’m learning Vue.js and I’m struggling to find a way to organize my code. I’m trying to make everything as modular as possible, so when making a slider i did the following: And in my view I simply use the component: But after I try to call echo, it looks for it in the parent scope, not in the banners
How to define a temporary variable in Vue.js template
Here is my current template: The problem is that i have to write rowLenMap[orderList[n – 1]] multiple times, and i’m afraid vue.js engine will also calculate it multiple times. What i want is something like this: I think it’s not difficult to implement technically because it can be clumsily solved by using something like v-for=”rowLen in [rowLenMap[orderList[n – 1]]]”. So