<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> -->
<script src="vue.global.js"></script>
<style>
.textColor{
color: aqua;
}
</style>
</head>
<body>
<div id="app">
<!-- value -->
<h3>value="vue快速入门"</h3>
<input type="text" value="vue快速入门">
<h3>v-bind:value="web.url"</h3>
<input type="text" v-bind:value="web.url">
<h3>:value="web.url"</h3>
<input type="text" :value="web.url">
<!-- src -->
<h3>src="./img/p2.png"</h3>
<img src="./img/p2.png" alt="">
<h3>:src="web.img"</h3>
<img :src="web.img" alt="">
<!-- class -->
<h3>class="textColor"</h3>
<b class="textColor">vue快速入门</b>
<h3>:class="{textColor:web.status}"</h3>
<b :class="{textColor:web.status}">vue快速入门</b>
</div>
<script type="module">
import {createApp,reactive} from './vue.esm-browser.js'
createApp({
setup(){
const web = reactive({
url: "https://unpkg.com/vue@3/dist/vue.global.js",
img: "./img/p2.png",
status: false,
})
return{
web,
}
}
}).mount("#app")
</script>
</body>
</html>
动态属性绑定 v-bind
最新推荐文章于 2024-09-09 11:08:24 发布