最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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: '請設(shè)置密碼!' }]}
            style={{ borderBottom: '1px solid #DCDCDC' }}
          >
            <Input
              bordered={false}
              type="password"
              placeholder="請設(shè)置密碼"
            />
          </Form.Item>
          <Form.Item
            name="password"
            rules={[{ required: true, message: '請重復(fù)密碼!' }]}
            style={{ borderBottom: '1px solid #DCDCDC' }}
          >
            <Input
              bordered={false}
              type="password"
              placeholder="請重復(fù)密碼"
            />
          </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>用戶服務(wù)協(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;
}

總結(jié)

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

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

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

相關(guān)文章

  • vue-extend和vue-component注冊一個全局組件方式

    vue-extend和vue-component注冊一個全局組件方式

    這篇文章主要介紹了vue-extend和vue-component注冊一個全局組件方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • element-ui 表格實現(xiàn)單元格可編輯的示例

    element-ui 表格實現(xiàn)單元格可編輯的示例

    下面小編就為大家分享一篇element-ui 表格實現(xiàn)單元格可編輯的示例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-02-02
  • vue?動態(tài)路由component?傳遞變量報錯問題解決

    vue?動態(tài)路由component?傳遞變量報錯問題解決

    這篇文章主要為大家介紹了vue?動態(tài)路由component?傳遞變量報錯問題解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-05-05
  • vue搜索頁開發(fā)實例代碼詳解(熱門搜索,歷史搜索,淘寶接口演示)

    vue搜索頁開發(fā)實例代碼詳解(熱門搜索,歷史搜索,淘寶接口演示)

    這篇文章主要介紹了vue搜索頁開發(fā)實例(熱門搜索,歷史搜索,淘寶接口演示),本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-04-04
  • 詳解Vue路由History mode模式中頁面無法渲染的原因及解決

    詳解Vue路由History mode模式中頁面無法渲染的原因及解決

    這篇文章主要介紹了詳解Vue路由History mode模式中頁面無法渲染的原因及解決,非常具有實用價值,需要的朋友可以參考下
    2017-09-09
  • 詳解vue渲染從后臺獲取的json數(shù)據(jù)

    詳解vue渲染從后臺獲取的json數(shù)據(jù)

    這篇文章主要介紹了詳解vue渲染從后臺獲取的json數(shù)據(jù),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-07-07
  • vue.js的提示組件

    vue.js的提示組件

    這篇文章主要為大家詳細介紹了vue.js實現(xiàn)一個漂亮、靈活、可復(fù)用的提示組件,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-03-03
  • vue中使用postcss-px2rem的兩種方法

    vue中使用postcss-px2rem的兩種方法

    這篇文章主要介紹了vue項目中使用postcss-px2rem的方法總結(jié),在項目中為了屏幕適配,經(jīng)常會用到rem,postcss-px2rem就是為了讓我們直接在將代碼中px自動轉(zhuǎn)化成對應(yīng)的rem的一個插件,需要的朋友可以參考下
    2022-05-05
  • vue實現(xiàn)懸浮球效果

    vue實現(xiàn)懸浮球效果

    這篇文章主要為大家詳細介紹了vue實現(xiàn)懸浮球效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-04-04
  • Vue3中實現(xiàn)微信掃碼登錄的步驟和代碼示例

    Vue3中實現(xiàn)微信掃碼登錄的步驟和代碼示例

    在 Vue 3 中實現(xiàn)微信掃碼登錄,涉及到前端生成二維碼、監(jiān)聽微信回調(diào)以及與后端的交互,本文給大家介紹了一個詳細的實現(xiàn)步驟和代碼示例,對大家的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下
    2024-07-07

最新評論

疏附县| 阿巴嘎旗| 清水县| 托克逊县| 东海县| 大理市| 西峡县| 正阳县| 大名县| 嘉兴市| 叙永县| 南宁市| 安顺市| 鲁甸县| 铁岭市| 翼城县| 霍林郭勒市| 平山县| 碌曲县| 台中市| 阿拉善左旗| 大洼县| 肃北| 呼玛县| 临沂市| 乐清市| 杭锦后旗| 怀安县| 渝北区| 江阴市| 峨边| 五华县| 平罗县| 昭觉县| 句容市| 罗源县| 彰化县| 平江县| 开化县| 吴堡县| 莱阳市|