snippiest store code example

Example: snippiest store

<template>
  <div>    
    <div> <h1>{{ fullname }}</h1> </div>
    
     <v-text-field
      label="Full Name"
v-model="fullname"
      hide-details="auto"
    ></v-text-field>
     <v-text-field
      label="First Name"
v-model="firstname"
      hide-details="auto"
    ></v-text-field>
     <v-text-field
      label="Last Name"
v-model="lastname"
      hide-details="auto"
    ></v-text-field>
  </div>
</template>

<script>
export default {
  data () {
    return {
      firstname:'Sandeep',
      lastname:'Thapa',
    }
  },
  computed: {
    fullname: {
      set:function(value){
        var fullname = value.split(' ')
        this.firstname = fullname[0]
        this.lastname = fullname[fullname.length -1]
      },
      get:function(){
        return this.firstname + " " + this.lastname}
    }
  }, 
}
</script>

Tags:

Misc Example