世界上最伟大的投资就是投资自己的教育
剧场模式




<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/vue@3.0.2"></script>
<title>Learning Vue</title>
<style>
.box {
padding: 100px 0;
width: 300px;
text-align: center;
background: #ddd;
margin: 20px;
display: inline-block;
}
</style>
</head>
<body>
<h1>Hello, Vue :)</h1>
<div id="app">
<div v-if="show">
<h2>{{ title }} - {{ author }} - {{ age }} </h2>
</div>
<button v-on:click="age++">Increase age</button>
<button v-on:click="age--">Decrease age</button>
<button @click="toggleShow">
<span v-if='show'>hide</span>
<span v-else>show</span>
<!-- <span v-if='!show'>show</span> -->
</button>
<div v-show="show">currently showing</div>
<div @click="title = 'something else'">change title</div>
<div @click="changeTitle('hello')">change title</div>
<br>
<!-- mouse events -->
<div class="box" @mouseover="handleEvent($event, {name: 'hello'})">mouseover (enter)</div>
<div class="box" @mouseleave='handleEvent'>mouseleave</div>
<div class="box" @dblclick='handleEvent'>double click</div>
<div class="box" @mousemove='handleMousemove'>position {{ x }} {{ y }}</div>
</div>
<script src="app.js"></script>
</body>
</html>
const app = Vue.createApp({
// template: '<h2>I am the template</h2>'
data() {
return {
show: false,
title: 'I am the ',
author: 'qiuzhi99',
age: 30,
x: 0,
y: 0
}
},
methods: {
changeTitle(title) {
this.title = title
},
toggleShow() {
this.show = !this.show;
},
handleEvent(e, data) {
console.log(e, e.type)
if (data) {
console.log(data)
}
},
handleMousemove(e) {
this.x = e.offsetX;
this.y = e.offsetY;
}
}
});
app.mount('#app');
▬▬▬▬▬▬ 联系我 👋 ▬▬▬▬▬▬
知乎:https://www.zhihu.com/people/rails365
掘金:https://juejin.cn/user/1574156379888263
b 站:https://space.bilibili.com/31152817
Github:https://github.com/hfpp2012
Youtube:https://www.youtube.com/channel/UCA-Jkgr40A9kl5vsIqg-BIg
Discord:https://discord.gg/5rdjnEnU7F
Twitter:https://twitter.com/qiuzhi99pro
Facebook:https://twitter.com/qiuzhi99pro
Instagram:https://www.facebook.com/pro.qiuzhi/
▬▬▬▬▬▬ 微信相关 👋 ▬▬▬▬▬▬
我的微信官网服务号精品文章订阅号微信视频号




© 汕尾市求知科技有限公司 | 专业版网站 | 在线学员:1132
粤公网安备 44152102000088号
| 粤ICP备19038915号
跟着大佬学 vue 了
随风 · 元婴 打赏此回复 1 仙灵石
大佬 直接讲新特性了 这些都是基础了
正常开发大家都用脚手架了 你应该直接用脚手架
后面要用的
嗯嗯,是的