v-fro的使用

v-for遍历数组和遍历对象

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
    {{message}}
  <ul>
<!--    直接遍历取得是对应的value值-->
    <li v-for="value in info">{{value}}</li>

    <ul>
      <li v-for="(value,key) in info">{{value}}--{{key}}</li>
    </ul>
  </ul>
</div>
<script src="../vue.js"></script>
<script>
  const app = new Vue({
    el: '#app',
    data: {
      message: 'hello',
      info: {
        name: 'caiheng',
        age: 28,
        height: 1.70
      }
    }
  })
</script>
</body>
</html>
上一篇:fro语句循环


下一篇:Computer Networking: Notes of "Select" Lectures (Chapter 4: Network Layer - data plane)