<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          【微信小程序|組件庫】登陸頁面(1)

          共 5964字,需瀏覽 12分鐘

           ·

          2021-05-05 13:24

          效果展示

          演示GIF
          用戶未點擊時
          用戶點擊時

          Demo代碼

          WXML

          <view class="login-box">
            <view class="title"> <text>Login</text></view>
            <form>
              <view class="user-box">
                <input type="text" name="" required="" placeholder="Username" />
              </view>
              <view class="user-box">
                <input type="password" name="" required="" placeholder="Password " />
              </view>
              <button hover-class="button_hover">
                <view></view>
                <view></view>
                <view></view>
                <view></view>
                Submit
              </button>
            </form>
          </view>

          WXSS

          page {
            height100%;
            margin0;
            padding0;
            backgroundradial-gradient(#f07c82, #f07c82);
          }

          .login-box {
            position: absolute;
            top50%;
            left50%;
            width300px;
            padding40px;
            transformtranslate(-50%, -50%);
            backgroundrgba(255255255, .9);
            box-sizing: border-box;
            box-shadow0 15px 25px rgba(000, .6);
            border-radius10px;
          }

          .login-box .title {
            color: black;
            margin-top: -20px;
            margin-bottom10px;
            font-size24px;
            font-weight500;
            text-align: center;
          }

          .login-box .user-box {
            position: relative;
          }

          .login-box .user-box input {
            width100%;
            padding10px 0;
            font-size16px;
            color#fff;
            margin-bottom30px;
            border: none;
            border-bottom1px solid #2177b8;
            outline: none;
            background: transparent;
          }

          .login-box button {
            position: relative;
            color: white;
            background-color#f9bd10;
            font-size16px;
            text-decoration: none;
            overflow: hidden;
            transition: .5s;
            letter-spacing4px;
            border-radius5px;
            box-shadow0 0 2px #f9bd10,
              0 0 2px #f9bd10,
              0 0 2px #f9bd10,
              0 0 20px #f9bd10;
          }

          .login-box .button_hover {
            background#f9bd10;
            color#fff;
            border-radius5px;
            box-shadow0 0 5px #f9bd10,
              0 0 25px #f9bd10,
              0 0 50px #f9bd10,
              0 0 100px #f9bd10;
          }

          .login-box button view {
            position: absolute;
            display: block;
          }

          .login-box button view:nth-child(1) {
            top0;
            left: -100%;
            width100%;
            height2px;
            border-radius2px;
            background: white;
            animation: btn-anim1 2s linear infinite;
          }

          @keyframes btn-anim1 {
            0% {
              left: -100%;
            }

            50%,
            100% {
              left100%;
            }
          }

          .login-box button view:nth-child(2) {
            top: -100%;
            right0;
            width2px;
            height100%;
            border-radius2px;
            background: white;
            animation: btn-anim2 2s linear infinite;
            animation-delay: .5s
          }

          @keyframes btn-anim2 {
            0% {
              top: -100%;
            }

            50%,
            100% {
              top100%;
            }
          }

          .login-box button view:nth-child(3) {
            bottom0;
            right: -100%;
            width100%;
            height2px;
            border-radius2px;
            background: white;
            animation: btn-anim3 2s linear infinite;
            animation-delay1s
          }

          @keyframes btn-anim3 {
            0% {
              right: -100%;
            }

            50%,
            100% {
              right100%;
            }
          }

          .login-box button view:nth-child(4) {
            bottom: -100%;
            left0;
            width2px;
            height100%;
            border-radius2px;
            background: white;
            animation: btn-anim4 2s linear infinite;
            animation-delay1.5s
          }

          @keyframes btn-anim4 {
            0% {
              bottom: -100%;
            }

            50%,
            100% {
              bottom100%;
            }
          }

          筆記

          Demo主要分為三個部分

          1. title
          2. input
          3. button

          難點在最后按鈕的實現(xiàn)上,具體原理可以參照「HTML+CSS」自定義按鈕樣式【004】

          需要注意的是:

          • 微信小程序中雖然css原生的hover可以演示,但是官方文檔給出的建議還是使用hover-class再替代:hover
          • 小程序中各個標簽都閉合
          • :valid、:focus小程序中不支持

          結語

          文章僅作為學習筆記,記錄從0到1的一個過程。

          希望對您有所幫助,如有錯誤歡迎小伙伴指正~

          我是 海轟?(?ˊ?ˋ)?

          如果您覺得寫得可以的話 請點個贊吧

          謝謝支持??


          瀏覽 50
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  最新无码国产精品色在线看 | 国产精品久久久久久久午夜 | 无码二级| 日本黄色视频网站片 | 精品欧美性爱 |