<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div id="app">
<img v-bind:src="imgUrl" alt="" />
<!-- 也可以简写 -->
<img :src="imgUrl" alt="" />
</div>
<script src="./vue.min.js"></script>
<script>
//vm: vue实例
var vm = new Vue({
//配置
el: "#app", //css选择器
data: {
//和界面相关的数据
imgUrl:
"http://pic.netbian.com/uploads/allimg/210203/232830-161236611012e2.jpg",
},
});
</script>
</body>
</html>
v-bind小例子
最新推荐文章于 2023-11-07 10:33:40 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)