微信小程序实现登录注册页面

一、在小程序中引入iconfont

1.在官网搜索需要的图标

2.将图标添加至项目

3.打开我的项目

4.选择font class,点击下方的链接,打开生成的源码

5.在styles文件夹下新建iconfont.wxss,拷贝生成的源码到该文件中

二、编写登录注册页面

.wxml文件:

<view style="margin-top:40%">
  <form bindsubmit="submit">
    <view class="form_item" style="margin-bottom: 20px;">
      <i class="iconfont icon-user"></i>
      <input type="text" placeholder="用户名" />
    </view>
    <view class="form_item" style="margin-bottom: 40px;">
      <i class="iconfont icon-password"></i>
      <input type="password" placeholder="密码" />
    </view>
    <view>
      <button class="login_btn">登录</button>
      <button>注册</button>
    </view>
  </form>
</view>

.less文件:

@formItemHeight: 36px;

@themeColor: rgb(50, 100, 192);

.form_item {
  margin: 0 50rpx;
  height: @formItemHeight;
  border: 1px solid @themeColor;
  border-radius: 5px;

  i {
    float: left;
    height: @formItemHeight;
    margin: 0 5px;
    font-size: 20px;
    color: @themeColor;
    line-height: @formItemHeight;
  }

  input {
    float: left;
    height: @formItemHeight;
  }

}

.login_btn {
  background: @themeColor;
  color: white;
  margin-bottom: 15px;
}

三、实现效果

  • 11
    点赞
  • 128
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值