uniapp 设计一个 小程序登录页面,写代码
时间: 2023-11-29 17:05:57 浏览: 30
<template>
<view class="container">
<view class="logo"></view>
<form class="login-form">
<view class="form-group">
<text class="form-label">用户名:</text>
<input class="form-input" type="text" placeholder="请输入用户名" v-model="username"/>
</view>
<view class="form-group">
<text class="form-label">密码:</text>
<input class="form-input" type="password" placeholder="请输入密码" v-model="password"/>
</view>
<button class="login-btn" @click="login">登录</button>
</form>
</view>
</template>
<script>
export default {
data() {
return {
username: '',
password: ''
}
},
methods: {
login() {
// 登录逻辑
}
}
}
</script>
<style>
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
}
.logo {
width: 100px;
height: 100px;
background-color: #333;
border-radius: 50%;
margin-bottom: 20px;
}
.login-form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 80%;
background-color: #fff;
padding: 20px;
border-radius: 10px;
}
.form-group {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 20px;
}
.form-label {
width: 80px;
}
.form-input {
flex: 1;
border: 1px solid #ccc;
border-radius: 5px;
padding: 5px;
}
.login-btn {
width: 100%;
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px;
margin-top: 20px;
cursor: pointer;
}
</style>
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.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)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)