欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Ant Design編寫登錄和注冊頁面的教程

 更新時間:2023年04月21日 09:12:43   作者:惜晨寶貝  
這篇文章主要介紹了Ant Design編寫登錄和注冊頁面的教程,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

前言

登錄頁面代碼和樣式,不多描述,直接看圖

登錄頁面

登錄分為賬號密碼登錄和手機登錄,使用tabs切換。

一、登錄

1.index.tsx頁面

代碼如下(示例):

import { Form, Input, Button, Tabs, Row, Col } from 'antd';
import { Footer } from 'antd/lib/layout/layout';
import React from 'react';
import styles from './index.module.less';

const onFinish = (values: any) => {
  console.log('Received values of form: ', values);
};

const { TabPane } = Tabs;
function callback(key) {
  console.log(key);
}
export default function Login() {
  return (
    <div className={styles.bg}>
      <div className={styles.heard}>
        <div className={styles.cloud}>
          <img src="../logo.png" alt="logo" />
        </div>
        <h1 className={styles.title}>項目名稱</h1>
      </div>
      <div className={styles.login_card}>
        <Tabs type="card" defaultActiveKey="1" onChange={callback} centered style={{ margin: '0 auto' }}>
          <TabPane tab="賬戶密碼登錄" key="1">
            <Form
              name="normal_login"
              className="login-form"
              initialValues={{ remember: true }}
              onFinish={onFinish}
            >
              <Form.Item
                name="username"
                rules={[{ required: true, message: '請輸入手機號 / 用戶名!' }]}
                style={{ borderBottom: '1px solid #DCDCDC' }}
              >
                <Input placeholder="請輸入手機號 / 用戶名" bordered={false} />
              </Form.Item>
              <Form.Item
                name="password"
                rules={[{ required: true, message: '請輸入密碼!' }]}
                style={{ borderBottom: '1px solid #DCDCDC' }}
              >
                <Input
                  bordered={false}
                  type="password"
                  placeholder="請輸入密碼"
                />
              </Form.Item>


              <Form.Item>
                <a style={{ color: '#8C8D9B' }} href="">創(chuàng)建賬號</a>
              </Form.Item>

              <Form.Item>
                <Button type="primary" htmlType="submit" block style={{ height: '56PX', borderRadius: '12PX' }}>
                  登錄
                </Button>
              </Form.Item>
            </Form>

          </TabPane>

          <TabPane tab="驗證碼登錄" key="2">
            <Form
              name="normal_login"
              className="login-form"
              initialValues={{ remember: true }}
              onFinish={onFinish}
            >
              <Form.Item
                name="phone"
                rules={[{ required: true, message: '請輸入手機號!' }]}
                style={{ borderBottom: '1px solid #DCDCDC' }}
              >
                <Input placeholder="請輸入手機號" bordered={false} />
              </Form.Item>
              <Form.Item
                name="captcha"
                rules={[{ required: true, message: '請輸入驗證碼!' }]}
                style={{ borderBottom: '1px solid #DCDCDC' }}
              >
                <Row>
                  <Col span={18}>
                    <Input
                      bordered={false}
                      type="password"
                      placeholder="請輸入驗證碼"
                    />
                  </Col>
                  <Col span={6} style={{ float: 'right' }}>
                    <Button type="link" style={{ color: '#151830', fontWeight: 'bold' }}>發(fā)送驗證碼</Button>
                  </Col>
                </Row>
              </Form.Item>


              <Form.Item>
                <a style={{ color: '#8C8D9B' }} href="">創(chuàng)建賬號</a>
              </Form.Item>

              <Form.Item>
                <Button type="primary" htmlType="submit" block style={{ height: '56PX', borderRadius: '12PX' }}>
                  登錄
                </Button>
              </Form.Item>


            </Form>

          </TabPane>

        </Tabs>

       <Button size="large" shape="circle"><img src="/weixin.png" alt="微信圖片" /></Button>

      </div>
      <Footer className={styles.footer}>
        <text>
          底部說明
        </text>
      </Footer>
    </div>
  )
}

2.index.module.less

代碼如下(示例):

.bg {
  height: 900px;
  background: linear-gradient(180deg, #a0d7e7, #6c5dd3);
  margin: auto;
  // padding: 200px;
  text-align: center;
  justify-content: center;
  display: flex;
  align-items: center;
}

.login_card {
  width: 520px;
  height: 450px;
  background: #f2f3f7;
  border-radius: 20px;
  margin: auto;
  text-align: center;
  justify-content: center;
  padding: 51px 60px;
}

.login-button {
  width: 400px;
  height: 56px;
  background: #6c5dd3;
  border-radius: 12px;
}

.heard {
  position: absolute;
  display: flex;
  top: 264px;
}
.title {
  width: 315px;
  font-size: 30px;
  font-family: Arial;
  font-weight: bold;
  color: #151830;
}
.cloud {
  width: 100px;
  height: 72px;
  line-height: 72px;
  background-image: url("../../../../public/img/cloud.png");
}
.cloud img {
  width: 40px;
  height: 40px;
}
.footer {
  width: 100%;
  height: 12px;
  font-size: 10px;
  font-family: Microsoft YaHei;
  font-weight: 300;
  color: #151830;
  background: none;
  bottom: 34px;
  left: 0;
  position: absolute;
}

二,注冊

注冊頁面代碼和樣式,不多描述,直接看圖

1.index.tsx

代碼如下(示例):

import React from 'react';
import { Form, Input, Button, Checkbox, Tabs, Row, Col } from 'antd';
import styles from './index.module.less';
import { Footer } from 'antd/lib/layout/layout';

const onFinish = (values: any) => {
  console.log('Received values of form: ', values);
};
export default function Register() {
  return (
    <div className={styles.bg}>
      <div className={styles.heard}>
        <div className={styles.cloud}>
          <img src="../logo.png" alt="logo" />
        </div>
        <h1 className={styles.title}>系統(tǒng)名稱</h1>
      </div>
      <div className={styles.login_card}>
        <Form
          name="normal_login"
          className="login-form"
          initialValues={{ remember: true }}
          onFinish={onFinish}
        >
          <Form.Item
            name="phone"
            rules={[{ required: true, message: '請輸入手機號!' }]}
            style={{ borderBottom: '1px solid #DCDCDC' }}
          >
            <Input placeholder="請輸入手機號" bordered={false} />
          </Form.Item>
          <Form.Item
            name="captcha"
            rules={[{ required: true, message: '請輸入驗證碼!' }]}
            style={{ borderBottom: '1px solid #DCDCDC' }}
          >
            <Row>
              <Col span={18}>
                <Input
                  bordered={false}
                  type="password"
                  placeholder="請輸入驗證碼"
                />
              </Col>
              <Col span={6} style={{ float: 'right' }}>
                <Button type="link" style={{ color: '#151830', fontWeight: 'bold' }}>發(fā)送驗證碼</Button>
              </Col>
            </Row>
          </Form.Item>
          <Form.Item
            name="password"
            rules={[{ required: true, message: '請設置密碼!' }]}
            style={{ borderBottom: '1px solid #DCDCDC' }}
          >
            <Input
              bordered={false}
              type="password"
              placeholder="請設置密碼"
            />
          </Form.Item>
          <Form.Item
            name="password"
            rules={[{ required: true, message: '請重復密碼!' }]}
            style={{ borderBottom: '1px solid #DCDCDC' }}
          >
            <Input
              bordered={false}
              type="password"
              placeholder="請重復密碼"
            />
          </Form.Item>

          <Form.Item>
            已有帳號,<a href="#" rel="external nofollow" >點擊登錄</a>
          </Form.Item>

          <Form.Item>
            <Button type="primary" htmlType="submit" block style={{ height: '56PX', borderRadius: '12PX' }}>
              登錄
            </Button>
          </Form.Item>
          <Form.Item name="" valuePropName="checked" style={{ textAlign: 'left' }}>
            <Checkbox style={{ color: '#CCCCCC' }}>我已閱讀并同意《<a>用戶服務協(xié)議</a>》</Checkbox>
          </Form.Item>
          <Button size="large" shape="circle"><img src="../weixin.png" alt="微信圖片" /></Button>

        </Form>
      </div>

      <Footer className={styles.footer}>
        <text>
          底部說明
        </text>
      </Footer>
    </div>
  );
}

2.index.module.less

代碼如下(示例):

.bg {
  height: 900px;
  background: linear-gradient(180deg, #a0d7e7, #6c5dd3);
  margin: auto;
  padding: 150px;
  text-align: center;
  justify-content: center;
  display: flex;
  align-items: center;
}

.login_card {
  width: 520px;
  height: 540px;
  background: #f2f3f7;
  border-radius: 20px;
  margin: auto;
  text-align: center;
  justify-content: center;
  padding: 51px 60px;
}

.login-button {
  width: 400px;
  height: 56px;
  background: #6c5dd3;
  border-radius: 12px;
}
.heard {
  position: absolute;
  display: flex;
  top: 218px;
}
.title {
  width: 315px;
  font-size: 30px;
  font-family: Arial;
  font-weight: bold;
  color: #151830;
}
.cloud {
  width: 100px;
  height: 72px;
  line-height: 72px;
  background-image: url("../../../../public/img/cloud.png");
}
.cloud img {
  width: 40px;
  height: 40px;
}
.footer {
  width: 100%;
  height: 12px;
  font-size: 10px;
  font-family: Microsoft YaHei;
  font-weight: 300;
  color: #151830;
  background: none;
  bottom: 34px;
  left: 0;
  position: absolute;
}

總結

好像沒啥重點,div垂直居中算個重點吧。

  justify-content: center;
  display: flex;
  align-items: center;

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

  • vue實現(xiàn)自定義"模態(tài)彈窗"組件實例代碼

    vue實現(xiàn)自定義"模態(tài)彈窗"組件實例代碼

    頁面中會有很多時候需要彈窗提示,我們可以寫一個彈窗組件,下面這篇文章主要給大家介紹了關于vue實現(xiàn)自定義"模態(tài)彈窗"組件的相關資料,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下
    2021-12-12
  • Vue.js通用應用框架-Nuxt.js的上手教程

    Vue.js通用應用框架-Nuxt.js的上手教程

    本篇文章主要介紹了Vue.js通用應用框架-Nuxt.js的上手教程,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-12-12
  • Vue2和Vue3的nextTick實現(xiàn)原理

    Vue2和Vue3的nextTick實現(xiàn)原理

    Vue 中的數(shù)據(jù)綁定和模板渲染都是異步的,那么如何在更新完成后執(zhí)行回調函數(shù)呢?這就需要用到 Vue 的 nextTick 方法了,本文詳細介紹了Vue2和Vue3的nextTick實現(xiàn)原理,感興趣的同學可以參考一下
    2023-04-04
  • 解決vue項目運行npm run serve報錯的問題

    解決vue項目運行npm run serve報錯的問題

    這篇文章主要介紹了解決vue項目運行npm run serve報錯的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-10-10
  • 完美解決element-ui的el-input設置number類型后的相關問題

    完美解決element-ui的el-input設置number類型后的相關問題

    這篇文章主要介紹了完美解決element-ui的el-input設置number類型后的相關問題,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-10-10
  • vue-cli 項目打包完成后運行文件路徑報錯問題

    vue-cli 項目打包完成后運行文件路徑報錯問題

    這篇文章主要介紹了vue-cli 項目打包完成后運行文件路徑報錯問題,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-07-07
  • vue實現(xiàn)圖片轉pdf的示例代碼

    vue實現(xiàn)圖片轉pdf的示例代碼

    這篇文章主要為大家詳細介紹了vue實現(xiàn)圖片轉pdf的相關知識,文中的示例代碼講解詳細,具有一定的借鑒價值,需要的小伙伴可以跟隨小編一起了解一下
    2023-08-08
  • vue+openlayers繪制省市邊界線

    vue+openlayers繪制省市邊界線

    這篇文章主要為大家詳細介紹了vue+openlayers繪制省市邊界線,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2020-12-12
  • Vue自定義過濾器格式化數(shù)字三位加一逗號實現(xiàn)代碼

    Vue自定義過濾器格式化數(shù)字三位加一逗號實現(xiàn)代碼

    這篇文章主要介紹了Vue自定義過濾器格式化數(shù)字三位加一逗號的實現(xiàn)代碼,需要的朋友可以參考下
    2018-03-03
  • 使用md5在vue中的axios請求時加密API問題

    使用md5在vue中的axios請求時加密API問題

    這篇文章主要介紹了使用md5在vue中的axios請求時加密API問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-01-01

最新評論