用vue写一个带样式登录页
时间: 2024-06-06 12:11:21 浏览: 1
好的,以下是一个用Vue写的带样式的登录页示例:
<template>
<div class="login-container">
<h1 class="title">欢迎登录</h1>
<form class="login-form" @submit.prevent="handleLogin">
<div class="form-item">
<label for="username">用户名:</label>
<input type="text" id="username" v-model="username" required autofocus>
</div>
<div class="form-item">
<label for="password">密码:</label>
<input type="password" id="password" v-model="password" required>
</div>
<div class="form-item">
<button type="submit">登录</button>
</div>
</form>
</div>
</template>
<script>
export default {
data() {
return {
username: '',
password: ''
}
},
methods: {
handleLogin() {
// 处理登录逻辑
}
}
}
</script>
<style scoped>
.login-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f1f1f1;
}
.title {
font-size: 24px;
margin-bottom: 30px;
}
.login-form {
background-color: #fff;
padding: 30px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.form-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
label {
font-size: 16px;
}
input {
width: 300px;
height: 30px;
font-size: 16px;
padding: 5px;
border-radius: 3px;
border: 1px solid #ddd;
}
button {
width: 100px;
height: 30px;
font-size: 16px;
color: #fff;
background-color: #42b983;
border: none;
border-radius: 3px;
cursor: pointer;
}
</style>
希望能帮到你!如果你还有其它问题,请随时问我。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)