Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

arrow function with computed property vue

<div id="app">
  Name : <input type = "text" v-model = "name" /> <br/><br/>
  My name is : {{getName}}
</div>
    
<script>
new Vue({
  el: '#app',
  data: {
    name:''
  },
  computed:{
    getName: (vm=this) => {         // passing vm = this as parameter
        return vm.name;
    }
  }
});
</script>
Source by passioncoding.com #
 
PREVIOUS NEXT
Tagged: #arrow #function #computed #property #vue
ADD COMMENT
Topic
Name
9+7 =