Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Created February 16, 2018 16:16
Show Gist options
  • Save juanbrujo/639cab15e9adfd008e023ea671dbf15f to your computer and use it in GitHub Desktop.
Save juanbrujo/639cab15e9adfd008e023ea671dbf15f to your computer and use it in GitHub Desktop.
VueJS 2 Characters left count && limit
<template>
<div>
<textarea v-model="companyDescription"></textarea>
Add a comment to this line
<p>{{ charactersLeft }}</p>
</div>
</template>
<script>
export default {
data () {
return {
companyDescription: '',
maxDescriptionCharacters: 100
}
},
computed: {
charactersLeft: function () {
let char = this.leWord.length
const limit = this.limit
if (char <= limit) {
return (limit - char) + ' / ' + limit + ' caracteres.'
} else {
this.leWord = this.leWord.substring(0, limit) + '...'
return limit + ' / ' + limit + ' caracteres.'
}
}
}
}
</script>
@ludreykimm
Copy link

The game also offers various modes to enhance your experience, packed with numerous attractive features. Game College Brawl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment