<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>属性绑定和属性简写</title>
</head>
<script type="text/javascript" src="js/vue.js" ></script>
<script>
window.onload = function(){
//配置是否允许检查代码,方便调试,生产环境中设置为false
Vue.config.devtools = true; //检查代码
Vue.config.productioinTip = false; //有强迫症的,可以关掉生产中的提示信息
let vm = new Vue({
el: "#div1",
data:{
url: ‘img/super_man.jpg‘,
w: ‘100px;‘,
h: ‘50px;‘
}
});
}
</script>
<body>
<div id="div1">
<img :src="url" :width="w" :height="h">
</div>
</body>
</html>
时间: 2024-10-29 00:03:11