I am trying to display a message once the user logs in.
In the case where number of characters exceed 8, how can I display only the first 8 characters of a name followed by ".." ? (Eg: Monalisa..)
new Vue({
el: '#app',
data: {
username: 'AVERYLONGGGNAMMEEE'
}
});
Here is my jsfiddle demo
Vuex is a state management pattern for vue. js. $t is the injected method from vue. js or Vue. i18n.
Conclusion. Vue gives you a bunch of good ways to hide the element on the screen. When using v-if="false" the element isn't rendered at all in the DOM. When using v-show="false" the element is rendered in the DOM, however, Vue applies the inline style display: none that hides the element completely.
<component> is a special vue element that is used in combination with the is attribute.
Here is my answer fiddle : ANSWER-DEMO
<div id="app">
<div v-if="username.length<8">Welcome, {{ username }}</div>
<div v-else>Welcome, {{ username.substring(0,8)+".." }}</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With