This example of the official guide works properly (of course). Then I tried by my own by making it a component, it also works. But once nested in a parent component, the message can not be reversed, and I can’t figure out why. Here is the JSFiddle : https://jsfiddle.net/37y1ukjh/ Answer Look at this fiddle. This is because of one-way data
Tag: vue.js
Vue.js : Passing an external variable to a component through initialization?
I am trying to pass a variable (here, externalVar) to a component, directly when initializing. But I can’t find how to do it (probably not understanding documentation well :/ ). What is the correct way to do it? The initialization : The component I am initializing here is defined like this (getting back variableToPass in data): But then , when
How can I use Blade in Vue files?
I’m trying to use Blade in my Vue file carousel-signUp.vue Like: But in the end I’m getting an error. The compiler can’t understand the difference between Vue syntax and Blade syntax. How can I define Blade syntax in Vue files? Or, does anyone have an idea how to use {{route(‘dump’)}} value in my vue file? Answer A better solution might
Setting a ‘default’ v-on event for a component within Vue
I have a set of ‘text-input’ custom components which house some boilerplate markup and an ‘input’ element. One way of getting the value of the ‘text-input’ in to it’s parent is to $emit an event when the value has changed. I need to capture and handle the $emit with a v-on for every text-input component: I feel that this introduces
Validating object structure in vue.js
I’m currently building a component in vue.js and I have a bit of a problem. You see, there’s a lot of parameters you can give to my component, so for the sake of clarity, I decided to go with the approach below: Basically, I define an object containing the necessary parameters and I give that to my component. The thing
How to add external JS scripts to VueJS Components?
I’ve to use two external scripts for the payment gateways. Right now both are put in the index.html file. However, I don’t want to load these files at the beginning itself. The payment gateway is needed only in when user open a specific component (using router-view). Is there anyway to achieve this? Thanks. Answer A simple and effective way to
Vue.js run a code in mounted and again for restart functionality
I am creating a game in VueJS, where, when the page loads, I want a method to fire, make an ajax call to an external API and create a bunch of data properties. When the player wins the round, I want to them to be able to see a button that allows them to restart the game. I am using
Vue js error: Component template should contain exactly one root element
I don’t know what the error is, so far I am testing through console log to check for changes after selecting a file (for uploading). When I run $ npm run watch, i get the following error: “Webpack is watching the files… 95% emitting ERROR Failed to compile with 1 errors 19:42:29 error in ./resources/assets/js/components/File.vue (Emitted value instead of an
How to initiate a function using data(){} but not mounted(){} while using vue-resource
This works, but I need to use mounted(){} to initiate the function which I think can be avoided but not sure how. This code doesn’t work, but I like to do something like this. Initiating the function in data(){} itself. Thanks in advance. Answer I agree with Decade Moon that your first approach is the better way to do it
Vue.js – can not add date/timepicker to the html element rendered by vue.js
I have a Vue.js component where there are groups of text fields ( group of a text field labelled “Start” and another text field labelled “To”) bound to a Vue array ( s.timespans) . What I want is, when I add another group of text field by adding element to the ( s.timespans ) array, all the textfields get date/timepicker.