Vue学习笔记3———循环语句

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<script src="js/Vue.js"></script>
	<body>
		<div id="app" >
			<p v-for="message in messages">{{message.information}}</p>
			
			<p v-for="per in person">{{per}}</p>
			
			<p v-for="(key,value) in person">{{key}}:{{value}}</p>
		</div>
		
		<script>
			new Vue({
				el:'#app',
				data:{
					messages:[
						{information:'1'},
						{information:'2'},
						{information:'3'},
						{information:'4'}
					],
					person:{
						name:'tom',
						age:'18'
					}
				}
			})
		</script>
	</body>
</html>

猜你喜欢

转载自blog.csdn.net/progammer10086/article/details/85791642