Difference between v-model and v-bind on Vue.js?

From here – Remember: <input v-model=”something”> is essentially the same as: <input v-bind:value=”something” v-on:input=”something = $event.target.value” > or (shorthand syntax): <input :value=”something” @input=”something = $event.target.value” > So v-model is a two-way binding for form inputs. It combines v-bind, which brings a js value into the markup and v-on:input to update the js value. The js … Read more

What is nextTick and what does it do in Vue.js?

It’s all about Timing nextTick allows you to execute code after you have changed some data and Vue.js has updated the virtual DOM based on your data change, but before the browser has rendered that change on the page. Normally, devs use the native JavaScript function setTimeout to achieve similar behavior, but using setTimeout relinquishes … Read more

Passing event and argument to v-on in Vue.js

If you want to access event object as well as data passed, you have to pass event and ticket.id both as parameters, like following: HTML <input type=”number” v-on:input=”addToCart($event, ticket.id)” min=”0″ placeholder=”0″> Javascript methods: { addToCart: function (event, id) { // use event here as well as id console.log(‘In addToCart’) console.log(id) } } See working fiddle: … Read more

Vue.js—Difference between v-model and v-bind

From here – Remember: <input v-model=”something”> is essentially the same as: <input v-bind:value=”something” v-on:input=”something = $event.target.value” > or (shorthand syntax): <input :value=”something” @input=”something = $event.target.value” > So v-model is a two-way binding for form inputs. It combines v-bind, which brings a js value into the markup and v-on:input to update the js value. The js … Read more

Pass data from child to parent in Vuejs (is it so complicated?)

Props are for parent -> child You can use $emit for child -> parent v-on directive captures the child components events that is emitted by $emit Child component triggers clicked event : export default { methods: { onClickButton (event) { this.$emit(‘clicked’, ‘someValue’) } } } Parent component receive clicked event: <div> <child @clicked=”onClickChild”></child> </div> … … Read more

Delete a Vue child component

Yes, the child component cannot delete itself. The reason is because the original data for rows is held in the parent component. If the child component is allowed to delete itself, then there will be a mismatch between rows data on parent and the DOM view that got rendered. Here is a simple jsFiddle for … Read more