微信小程序登录界面代码
时间: 2023-09-30 08:06:35 浏览: 59
以下是微信小程序登录界面代码示例:
1. wxml 文件
```html
<view class="container">
<view class="logo"></view>
<form class="form" bindsubmit="login">
<input class="input" type="text" placeholder="请输入用户名" name="username" />
<input class="input" type="password" placeholder="请输入密码" name="password" />
<button class="button" formType="submit">登录</button>
</form>
</view>
```
2. wxss 文件
```css
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
.logo {
width: 80px;
height: 80px;
background-image: url('/images/logo.png');
background-size: cover;
margin-bottom: 20px;
}
.form {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 80%;
}
.input {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
margin-bottom: 10px;
width: 100%;
}
.button {
background-color: #007aff;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px;
width: 100%;
}
```
3. js 文件
```javascript
Page({
login(e) {
const { username, password } = e.detail.value;
// 发送登录请求
},
});
```
在实际开发中,需要根据具体需求进行相应的修改和优化。