Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div id="app">
     {{ total }}
    
  </div>
  
  
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
  
</body>
</html>
 
const app = new Vue({
  
  el: '#app',
  
  data: {
    persons: [
    {Name: 'Ali', Family: 'Bahaari', Age: 20, Count: 0, price: 200},
    {Name: 'Akbar', Family: 'Jahan', Age: 30, Count: 0, price: 2500},
    {Name: 'Amir', Family: 'Pirozi', Age: 40, Count: 0, price: 500},
    {Name: 'Reza', Family: 'Khosravi', Age: 50, Count: 0, price: 100}
    ]
  },
  
  computed: {
     total() {
       let total = 0
       this.persons.forEach(person => total += person.price )
       return total
     }
  }
  
})
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers