This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<input type="file" multiple accept="image/jpeg" @change="detectFiles($event.target.files)"> | |
<div class="progress-bar" :style="{ width: progressUpload + '%'}">{{ progressUpload }}%</div> | |
</div> | |
</template> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const heros = [ | |
{ label: 'Batman' }, | |
{ label: 'Iron Man' }, | |
{ label: 'Superman' }, | |
{ label: 'Green Lantern' }, | |
{ label: 'Cat Woman' }, | |
{ label: 'Supergirl' }, | |
{ label: 'Aquaman' } | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// replicate an object excepting some items | |
const hero = { | |
name: 'Bruno', | |
alterego: 'Batman', | |
superpowers: false, | |
couching: 8 | |
} | |
// Way one | |
const { couching, name, ...collection } = hero |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Two Ways To round a number at 2 decimals | |
const number = 19.5862365 | |
// Way one | |
let result = Math.round(number * 100) / 100 | |
console.log(result) | |
// Way two | |
result = parseFloat(number.toFixed(2)) // parseFloat() to keep number type | |
console.log(result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Two ways to remove array duplicates | |
const array = [1, 2, 3, 4, 4, 4, 5] | |
// Way 1 | |
let uniq = array.filter((el, index) => array.indexOf(el) === index) | |
console.log(uniq) | |
// Way 2 | |
uniq = [...new Set(array)] | |
console.log(uniq) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Two ways to filter an Array of Objects | |
const heros = [ | |
{ label: 'Batman' }, | |
{ label: 'Iron Man' }, | |
{ label: 'Superman' }, | |
{ label: 'Green Lantern' } | |
] | |
const token = 'Superman' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hypothetical undefined value | |
const name = undefined | |
// Way 1: | |
const firstName1 = name || 'Marcelo' | |
console.log(firstName1) | |
// Way 2: | |
const firstName2 = name ? name : 'Marcelo' | |
console.log(firstName2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { QUploaderBase } from 'quasar' | |
export default { | |
props: ['refStorage'], | |
name: 'FirebaseUploader', | |
data () { | |
return { | |
uploading: '', | |
uploadTask: {} |
OlderNewer