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>
标签:el,遍历,app,fro,value,caiheng,使用,message 来源: https://www.cnblogs.com/ch2020/p/14832966.html