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">
    <ul>
      <li v-for="(item, index) in list">
        {{ item.id }} {{ item.name }}
        
        <input type="text" placeholder="自己手打加上數字">
      </li>
    </ul>
    
    <button @click="reverseArray" >反轉陣列</button>
  </div>
  
  
  
  
  <!-- development version, includes helpful console warnings -->
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</body>
</html>
 
new Vue({
  el: '#app',
  data: {
    list: [
      { id: '01', name: '甲甲甲' },
      { id: '02', name: '乙乙乙' },
      { id: '03', name: '丙丙丙' }
    ]
  },
  methods: {
    reverseArray: function () {
      this.list.reverse();
      console.log(this.list)
    },
  }
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers