parent
7affee848b
commit
23513e8553
2 changed files with 60 additions and 0 deletions
@ -0,0 +1,29 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="en"> |
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edfe"> |
||||||
|
<script src="https://unpkg.com/vue@3.3.4/dist/vue.global.js"></script> |
||||||
|
<title>v-bind</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<div id="app"> |
||||||
|
<img v-bind:src="imgSrc" v-bind:title="imgTitle"> |
||||||
|
<img :src="imgSrc" :class="isActive?'active':''"> |
||||||
|
<img :src="imgSrc" :class="{active:!isActive}"> |
||||||
|
</div> |
||||||
|
<script type="text/javascript"> |
||||||
|
const App = { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
imgSrc: "https://www.baidu.com/img/PCfb_5bf082d29588c07f842ccde3f97243ea.png", |
||||||
|
imgTitle: "百度一下下", |
||||||
|
isActive: true, |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
Vue.createApp(App).mount("#app") |
||||||
|
</script> |
||||||
|
</body> |
||||||
|
</html> |
@ -0,0 +1,31 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="en"> |
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edfe"> |
||||||
|
<script src="https://unpkg.com/vue@3.3.4/dist/vue.global.js"></script> |
||||||
|
<title>v-if</title> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<div id="app"> |
||||||
|
<img src="https://v2.cn.vuejs.org/images/logo.svg" alt="" v-show="true"> |
||||||
|
<img src="https://v2.cn.vuejs.org/images/logo.svg" alt="" v-show="false"> |
||||||
|
<h2 v-show="isShow">对象形式</h2> |
||||||
|
<h2 v-if="age<18">未成年</h2> |
||||||
|
<h2 v-else-if="age<35">还凑合能干</h2> |
||||||
|
<h2 v-else>没人要了</h2> |
||||||
|
</div> |
||||||
|
<script type="text/javascript"> |
||||||
|
const App = { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
isShow: false, |
||||||
|
age: 33, |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
Vue.createApp(App).mount("#app") |
||||||
|
</script> |
||||||
|
</body> |
||||||
|
</html> |
Loading…
Reference in new issue