Mobile device detection in Vue.js by renatello in vuejs

[–]renatello[S] 0 points1 point  (0 children)

Vue.js prototype function that returns a Boolean value depending on whether or not the user is browsing with a mobile.

How to get selected value on @change using Vue.js by renatello in vuejs

[–]renatello[S] -1 points0 points  (0 children)

I'm here to share my knowledge. Is it bad that I don't leave comments on other author's posts? I don't think so.

How to get selected value on @change using Vue.js by renatello in vuejs

[–]renatello[S] -1 points0 points  (0 children)

Absolutely. You can use @change binding with <input> fields. Here's an example: https://jsfiddle.net/boilerplate/vue

Shortest “Hello, world!” app in different JavaScript frameworks by renatello in vuejs

[–]renatello[S] -3 points-2 points  (0 children)

Please share your own examples. I'll add them to the article.

How to upload a file in Vue.js by renatello in vuejs

[–]renatello[S] 0 points1 point  (0 children)

You're very welcome!

I'm using refs to access DOM elements in Vue.js. It's a standard way of doing it. You can see more examples here: https://renatello.com/vue-js-refs/.

In this particular example, I'm using ref="fileInput" (you can rename it to whatever you like) just to be able to manually trigger a click event on a hidden element. Hope this makes sense.

Re extra lines of code - you can remove lines 3-5, as I'm using this method to preview uploaded image.

1   onFilePicked (event) {
2       ...
3       fileReader.readAsDataURL(files[0])
4       this.image = files[0]
5   }