108,127 questions
204
votes
6
answers
165k
views
[Vue warn]: Cannot find element
I'm using Vuejs. This is my markup:
<body>
<div id="main">
<div id="mainActivity" v-component="{{currentActivity}}" class="activity"></div>
</div>
</body>
...
11
votes
3
answers
11k
views
How to determine when Vue has finished updating the DOM?
I want to access the inner <input> element after it has been created by Vue:
<li v-repeat="subtask: subtasks">
<input v-model="subtask.name" type="text">
</li>
However, ...
3
votes
1
answer
4k
views
Vue.js: Calculate average and update field
I am trying to calculate the average of sub grades that aren't equal to zero and setting a binded input to that new average value.
The sub grades have a v-on directive that calls a calcAverage() ...
12
votes
1
answer
19k
views
How do I display data through components with Vue.js (using Vueify)?
I'm having trouble getting data to display in my Vue components. I'm using Vueify and I'm trying to load an array of listings from the listings.vue component and I keep getting errors. Also, I don't ...
3
votes
1
answer
2k
views
Displaying HTML if data is empty
HTML:
<div id="demo">
<h1>{{title | uppercase}}</h1>
<ul>
<li v-repeat="todos" v-on="click: done = !done" class="{{done ? 'done' : ''}}">
{{...
1
vote
1
answer
613
views
Vue components don't get attached if transcluded in parent components that have `v-if`
Fiddle: http://jsfiddle.net/6Lt7kc94/3/
parent component
<div v-component="child">
<div v-component="transcluded"></div>
</div>
child component (visible is hardcoded to ...
2
votes
1
answer
7k
views
VueJS - How to initialize a template dynamically with the result of an ajax call
I want to load the template for a VueJS component dynamically. I'd like to make an AJAX call using jQuery, and whatever the server returns should be the template of the VueJS component. Here's a ...
1
vote
1
answer
2k
views
VueJS - Initializing a tagsinput form field that was loaded as part of template or $el attribute?
I'm following the pattern described in the official documentation of loading views using components. One of the components has a form field I need to have a method called .tagsinput() called on since ...
3
votes
3
answers
22k
views
Vue JS - Putting Json on data
I want to put my JSON data into Vue data, and a display, why can't I get to work?
compiled: function(){
var self = this;
console.log('teste');
$.ajax({
url: 'js/fake-ws.json',
...
9
votes
2
answers
4k
views
Is there a way to initialize a Vue object preserving initial HTML
I want to use Vue.js to more easily manipulate the DOM but when I initialize a Vue object it rewrites initial data that is generated with backend at first before manipulating.
For example I have this ...
1
vote
1
answer
3k
views
Vue.js: Default data in component is always overridden with v-with
I have a language selector view that includes a dropdown component. I want to set a default property (isOpen) in the dropdown component and then include computed data from the language selector, that ...
1
vote
1
answer
5k
views
How to keep data in component when using v-with in Vue js
So here is my problem:
I want to make a component that takes it's values from v-with="values" and add them to my component model after some modification, then display those modified properties.
But ...
2
votes
1
answer
2k
views
Angular/Vue.js loop through two objects in same directive
I don't know if what I'm trying to do is possible. I'm trying to create an Angular directive that repeats over a data object and prints out its values as well as the values of a second unrelated ...
93
votes
12
answers
183k
views
DOM element to corresponding vue.js component
How can I find the vue.js component corresponding to a DOM element?
If I have
element = document.getElementById(id);
Is there a vue method equivalent to the jQuery
$(element)
3
votes
4
answers
2k
views
Using v-attr with attribute that contains colon 'xmlns:href' does not compile
I am trying to use v-attr to add an attribute that contains a colon which is a delimiter for Vuejs key:value. It doesn't compile.
<svg>
<use xmlns:xlink="http://www.w3.org/1999/xlink"
...
0
votes
2
answers
3k
views
Replacing a reference to an observable array in Vue
I am trying to keep my data somewhat separate from my viewmodels by setting them by assignment. I'd like to replace an array and have the DOM update, as in this example:
demo.items = demo.items....
1
vote
1
answer
3k
views
VueJS transitions using v-view
I'm looking to animate the appearance of new elements and the disappearance of old elements when you change the component a v-view element is bound to. However because changing the ViewModel actually ...
3
votes
2
answers
8k
views
Watching a computed attribute in VueJS
In my project I have a form that can only be submitted when certain fields are filled in, so I've created the canSubmit function in my ViewModel:
var vm = new Vue({
data: {
experiments: []...
7
votes
2
answers
13k
views
Dynamic component and template loading with VueJS
I'm considering using VueJS for a multi page website. In the official example of routing, they show that you can dynamically change the template and component based on the URL, but they still have all ...
0
votes
1
answer
2k
views
Javascript memory leak with Vue JS and Velocity JS
I have been working with Velocity.js and Vue.js and ran into a memory leak. Fiddle of the issue: You can see an example in this fiddle: http://jsfiddle.net/hRAn7/3/
$(function () {
var ExtVue = ...
1
vote
1
answer
8k
views
vue.js form validation and ajax submit
I'm trying to use vue.js to do form validation and when the element is valid to submit it via ajax. But I can't get past the validation part.
My html:
<div id='form' 'v-on'="change:updateForm"&...
11
votes
3
answers
44k
views
Vue.js if else in view
Is it possible to have an if / else statement which does not render any html in a view similar to knockout:
<!-- ko if: someExpressionGoesHere -->
0
votes
1
answer
100
views
Component inserted with tag name doesn't work
I'm working on a component that will be inserted into the DOM with a tag name like so: <component></component> instead of the v-component directive. For some reason it's not working.
http:...
14
votes
1
answer
8k
views
How to do transclusion in vue.js?
I'm trying to make a bootstrap modal component with the awesome vue.js, but I haven't been able to find a good way to transclude- that is, I want to bundle several nested elements containing the ...
24
votes
4
answers
8k
views
Use cases for vue.js directive vs component?
When should I use a directive vs a component in vue.js? I'm implementing some stuff from Bootstrap and it looks like I could do it either way (I'm starting with the dropdown menu).
I get the feeling ...
9
votes
3
answers
38k
views
How to get the view or component object using its name in Vue js?
Javascript code:
var main = new Vue({
el: "#main",
data: {
currentView: "top",
},
});
var topComponent = Vue.component('top', Vue.extend({
...
35
votes
4
answers
25k
views
vue.js - Organize big single page application with multiple views
I'm playing with new MVVM framework - Vue.js (http://vuejs.org/).
It was really nice in simple examples and demos but now I'm trying to create big SPA with multiple views and I'm realizing that the ...