(精华2020年5月4日更新) vue教程篇 v-bind的使用

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>属性绑定和属性的简写</title>
	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	<script>
		window.onload=function(){
			let vm=new Vue({
				el:'#itany',
				data:{
					url:'https://www.baidu.com',
					w:'200px',
					h:'200px',
					tag:'xxxxx'
				}
			});
		}
	</script>
</head>
<body>
	<div id="itany">
		<!-- <img src="{{url}}"> -->

		<!-- 可以直接访问vue中的数据,不需要使用{{}} -->
		<!-- <img v-bind:src="url" v-bind:tag="tag"> -->

		<img :src="url" :width="w" :height="h">
	</div>
</body>
</html>

你可能感兴趣的:((持续更新)vue基础篇)