Skip to content
Advertisement

Tag: vuejs2

Vue.js working with input from a barcode scanner

I’ve stumbled upon an interesting case in a web-module, designed for both user- and machine-input (via a barcode scanner). Here is the code from Vue’s module: The scanner can trigger keyup.enter at the end, but it inputs the barcode so fast, that the model does not update. Only by adding 10 ms delay after the input (custom setting in the

Conditional import in Vue component

I have a root instance that has several CustomVideo-components in it (amongst a bunch of other components). The CustomVideo-component implements VideoJS, but it’s not on all pages that there is a CustomVideo-component, so I don’t want to import VideoJS globally. Here is an example of components on a page: In the top of CustomVideo, I import VideoJS, like so: But

How to include vue app inside another vue app?

I’m currently requested to generate widget that will be included in different customers web sites. Let’s say somthing like: There is 2 constraintes: The use of iframe is forbidden The customers website could be done in whatever thecnology (PHP, React, ANgular, Vue.js, JQuery,…) As the requested widget should be interactive, I wanted to develop it using javascript framwork (I thought

Style Binding makes app no show up anymore in Vue

What I’m trying to do is to make small 20px x 20px boxes of different colors in Vue. But, whenever I try to do :style='{ background-color: color.text }’ (color is an object in the data with property text), it just breaks the app and it shows up with nothing. Sceenshot without :style='{ background-color: color.text }’ Screenshot of inspector with :style='{

How does vue watch sublist change or v-model

I try to watch a list that has sub list and some <input> can change the sublist well. when I modify the input,watcher doesn’t work Answer Do a deep watch in order to watch nested changes and trigger the watch: Interesting: If the nested data is any of the following, the watch will not fire without a deep watch: array

[Vue warn]: Invalid prop: type check failed for prop “xxx”. Expected Number with value X, got String with value “X”

App.vue MyComponent.vue All works great until I increase the number un in the numeric textbox: (from initial ‘5’ to ‘6’): Error: vue.runtime.esm.js?2b0e:619 [Vue warn]: Invalid prop: type check failed for prop “daysNumber”. Expected Number with value 6, got String with value “6”. found in Answer You need to add the .number modifier to v-model, otherwise the type from the input

Vuejs: how do you pass class(classes) to template?

What is the right syntax to pass class to %item.class% in the following code? Any syntax like [item.class] or {{ item.class }} passes it as string without render. How to pass it properly? How to pass several classes and apply to several tags (a, span etc.) nested in one template? Pass an array? How to iterate it? Thanks beforehands 🙂

Advertisement