用vue 写一个登陆界面
时间: 2024-05-09 12:18:34 浏览: 106
由于我是AI语言模型,无法直接提供完整的代码,以下是一个简单的Vue登录界面示例:
template:
```
<div class="login-container">
<form class="login-form">
<h1>登录</h1>
<div class="form-group">
<label for="username">用户名:</label>
<input type="text" id="username" v-model="username" />
</div>
<div class="form-group">
<label for="password">密码:</label>
<input type="password" id="password" v-model="password" />
</div>
<button type="button" @click="login">登录</button>
</form>
</div>
```
script:
```
export default {
data() {
return {
username: '',
password: ''
}
},
methods: {
login() {
// 登录逻辑
}
}
}
```
style:
```
.login-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.login-form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 20px;
border: 1px solid #ddd;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
.form-group {
display: flex;
align-items: center;
margin-bottom: 10px;
}
label {
margin-right: 10px;
}
input {
height: 30px;
padding: 5px;
border: 1px solid #ddd;
border-radius: 5px;
outline: none;
}
button {
height: 40px;
padding: 0 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
outline: none;
cursor: pointer;
}
button:hover {
background-color: #0069d9;
}
```
阅读全文