<!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="./vue.js"></script>
<style>
body {
width: 100%;
height: 500px;
background-color: aliceblue;
}
.root {
width: 375px;
height: 667px;
margin: 0 auto;
border: 2px solid #333;
}
.header {
width: 100%;
height: 100px;
margin-top: 20px;
border-bottom: 1px solid #e2cacabd;
display: flex;
justify-content: center;
}
header a {
line-height: 50px;
text-align: center;
color: #333;
}
.main {
padding: 10px;
padding-top: 15px;
width: 100%;
}
.main input {
margin-top: 10px;
height: 20px;
width: 350px;
margin: 0 auto;
padding: 5px;
}
.footer {
width: 100%;
}
button {
background-color: #3131e4;
color: aliceblue;
border: none;
height: 20px;
width: 350px;
margin: 0 auto;
margin-top: 20px;
display: block;
}
img {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="root">
<div class="header">
<a href="" @click.prevent="seen1">账号登录</a>
<a href="" @click.prevent="seen2">二维码登录</a>
</div>
<div class="q1" v-if="seen">
<div class="main">
<input type="text" v-model="username" placeholder="请输入手机号邮箱">
<input type="password" v-model="password" placeholder="请输入密码">
</div>
<div class="footer">
<button type="submit" @click="login">登录</button>
</div>
</div>
<div class="q2" v-else>
<img src="./image/c6cfd30cadfc1d6ab1a19a90fea5f3c.jpg" alt="">
</div>
</div>
<script>
new Vue({
el: ".root",
data: {
seen: true,
username: '',
password: '',
},
methods: {
seen1: function() {
this.seen = !this.seen;
},
seen2: function() {
this.seen = !this.seen;
},
login: function() {
console.log(this.username, this.password);
// 假设验证成功,跳转到首页
}
},
})
</script>
</body>
</html>
08-27