首頁(yè)

js谷歌地圖 根據(jù)國(guó)家添加不同的點(diǎn)擊事件

前端達(dá)人

以下是在 JavaScript 和 Google 地圖 API 中添加點(diǎn)擊事件,根據(jù)國(guó)家進(jìn)行不同操作的示例代碼:


//創(chuàng)建地圖對(duì)象
var map = new google.maps.Map(document.getElementById('map'), {
  zoom: 4,
  center: {lat: 37.0902, lng: -95.7129}
});

//創(chuàng)建信息窗口(infowindow)
var infowindow = new google.maps.InfoWindow();

//創(chuàng)建一個(gè)數(shù)組來存儲(chǔ)標(biāo)記
var markers = [];

//為每個(gè)國(guó)家添加點(diǎn)擊事件
google.maps.event.addListener(map, 'click', function(event) {
  //獲取點(diǎn)擊位置的經(jīng)緯度坐標(biāo)
  var latLng = event.latLng;

  //使用地理編碼器(geocoder)將經(jīng)緯度坐標(biāo)轉(zhuǎn)換為地址信息
  var geocoder = new google.maps.Geocoder();
  geocoder.geocode({'location': latLng}, function(results, status) {
    if (status === 'OK') {
      if (results[0]) {
        //獲取點(diǎn)擊位置所在的國(guó)家名稱
        var countryName = '';
        for (var i = 0; i < results[0].address_components.length; i++) {
          var component = results[0].address_components[i];
          if (component.types.indexOf('country') !== -1) {
            countryName = component.long_name;
            break;
          }
        }

        //根據(jù)國(guó)家名稱執(zhí)行相應(yīng)操作
        switch (countryName) {
          case 'China':
            alert('您點(diǎn)擊了中國(guó)');
            break;
          case 'United States':
            alert('您點(diǎn)擊了美國(guó)');
            break;
          default:
            alert('您點(diǎn)擊了' + countryName);
        }

        //創(chuàng)建標(biāo)記并將其添加到地圖上
        var marker = new google.maps.Marker({
          position: latLng,
          map: map
        });

藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~ 希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。  分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。  藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 、平面設(shè)計(jì)服務(wù)、UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司。 

用cesium.js 制作一個(gè)球形地圖

前端達(dá)人

要用 Cesium.js 制作一個(gè)球形地圖,可以按照以下步驟:

  1. 在 HTML 文件中添加 Cesium.js 庫(kù)文件的引用??梢酝ㄟ^以下方式獲取最新版的 Cesium.js 庫(kù)文件鏈接:https://cesium.com/downloads/。

  2. 創(chuàng)建一個(gè) div 元素來容納地球場(chǎng)景,并設(shè)置其樣式以占滿整個(gè)屏幕。

  3. 在 JavaScript 文件中創(chuàng)建 Cesium.Viewer 對(duì)象并將其附加到之前創(chuàng)建的 div 元素上。這將在屏幕上顯示一個(gè)球體,并啟動(dòng) Cesium.js 場(chǎng)景。

  4. 可以通過更改 Viewer 對(duì)象的屬性來自定義地球的外觀和行為。例如,可以更改攝像機(jī)的位置和方向、加載不同類型的地圖數(shù)據(jù)、添加標(biāo)記等等。

以下是一個(gè)簡(jiǎn)單的示例代碼:


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>My Cesium App</title>
    <style>
        #cesiumContainer {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
    </style>
    <script src="https://cesium.com/downloads/cesiumjs/releases/1.85/Build/Cesium/Cesium.js"></script>
    <link  rel="stylesheet">
</head>
<body>
    <div id="cesiumContainer"></div>
    <script>
        var viewer = new Cesium.Viewer('cesiumContainer');
    </script>
</body>
</html>
這將創(chuàng)建一個(gè)簡(jiǎn)單的地球場(chǎng)景,可以在其中添加更
藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~ 希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。  分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。  藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 、平面設(shè)計(jì)服務(wù)、UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司。 

CSS旋轉(zhuǎn) 動(dòng)畫效果

前端達(dá)人

目錄

動(dòng)畫基本使用

 動(dòng)畫序列

 動(dòng)畫常見屬性

動(dòng)畫簡(jiǎn)寫屬性

大數(shù)據(jù)熱點(diǎn)圖案例

速度曲線之steps步長(zhǎng)


動(dòng)畫基本使用

動(dòng)畫(animation)是CSS3中具有顛覆性的特征之一,可通過設(shè)置多個(gè)節(jié)點(diǎn)來精確控制一個(gè)或一組動(dòng)畫,常 用來實(shí)現(xiàn)復(fù)雜的動(dòng)畫效果。

相比較過渡,動(dòng)畫可以實(shí)現(xiàn)更多變化,更多控制,連續(xù)自動(dòng)播放等效果。

制作動(dòng)畫分為兩步: 1.先定義動(dòng)畫 2.再使用(調(diào)用)動(dòng)畫

1. 用keyframes 定義動(dòng)畫(類似定義類選擇器)

@keyframes 動(dòng)畫名稱 {

                   0%{

                                width:100px;

                                }

                        100%{

                                width:200px;

                }

}

動(dòng)畫序列 

0% 是動(dòng)畫的開始,100% 是動(dòng)畫的完成。這樣的規(guī)則就是動(dòng)畫序列。

在 @keyframes 中規(guī)定某項(xiàng) CSS 樣式,就能創(chuàng)建由當(dāng)前樣式逐漸改為新樣式的動(dòng)畫效果。

動(dòng)畫是使元素從一種樣式逐漸變化為另一種樣式的效果。您可以改變?nèi)我舛嗟臉邮饺我獾拇螖?shù)。

請(qǐng)用百分比來規(guī)定變化發(fā)生的時(shí)間,或用關(guān)鍵詞 "from" 和 "to",等同于 0% 和 100%。

2. 元素使用動(dòng)畫

div {

width: 200px;

height: 200px;

background-color: aqua;

margin: 100px auto; /* 調(diào)用動(dòng)畫 */

animation-name: 動(dòng)畫名稱;

/* 持續(xù)時(shí)間 */ animation-duration: 持續(xù)時(shí)間; } 

 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. /* 我們想頁(yè)面一打開,一個(gè)盒子就從左邊走到右邊 */
  10. /* 1. 定義動(dòng)畫 */
  11. @keyframes move {
  12. /* 開始狀態(tài) */
  13. 0% {
  14. transform: translateX(0px);
  15. }
  16. /* 結(jié)束狀態(tài) */
  17. 100% {
  18. transform: translateX(1000px);
  19. }
  20. }
  21. div {
  22. width: 200px;
  23. height: 200px;
  24. background-color: pink;
  25. /* 2. 調(diào)用動(dòng)畫 */
  26. /* 動(dòng)畫名稱 */
  27. animation-name: move;
  28. /* 持續(xù)時(shí)間 */
  29. animation-duration: 2s;
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <div></div>
  35. </body>
  36. </html>

 動(dòng)畫序列

 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. /* from to 等價(jià)于 0% 和 100% */
  10. /* @keyframes move {
  11. from {
  12. transform: translate(0, 0);
  13. }
  14. to {
  15. transform: translate(1000px, 0);
  16. }
  17. } */
  18. /* 動(dòng)畫序列 */
  19. /* 1. 可以做多個(gè)狀態(tài)的變化 keyframe 關(guān)鍵幀 */
  20. /* 2. 里面的百分比要是整數(shù) */
  21. /* 3. 里面的百分比就是 總的時(shí)間(我們這個(gè)案例10s)的劃分 25% * 10 = 2.5s */
  22. @keyframes move {
  23. 0% {
  24. transform: translate(0, 0);
  25. }
  26. 25% {
  27. transform: translate(1000px, 0)
  28. }
  29. 50% {
  30. transform: translate(1000px, 500px);
  31. }
  32. 75% {
  33. transform: translate(0, 500px);
  34. }
  35. 100% {
  36. transform: translate(0, 0);
  37. }
  38. }
  39. div {
  40. width: 100px;
  41. height: 100px;
  42. background-color: pink;
  43. animation-name: move;
  44. animation-duration: 10s;
  45. }
  46. </style>
  47. </head>
  48. <body>
  49. <div>
  50. </div>
  51. </body>
  52. </html>

 動(dòng)畫常見屬性

 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. @keyframes move {
  10. 0% {
  11. transform: translate(0, 0);
  12. }
  13. 100% {
  14. transform: translate(1000px, 0);
  15. }
  16. }
  17. div {
  18. width: 100px;
  19. height: 100px;
  20. background-color: pink;
  21. /* 動(dòng)畫名稱 */
  22. animation-name: move;
  23. /* 持續(xù)時(shí)間 */
  24. /* animation-duration: 2s; */
  25. /* 運(yùn)動(dòng)曲線 */
  26. /* animation-timing-function: ease; */
  27. /* 何時(shí)開始 */
  28. animation-delay: 1s;
  29. /* 重復(fù)次數(shù) iteration 重復(fù)的 conut 次數(shù) infinite 無限 */
  30. /* animation-iteration-count: infinite; */
  31. /* 是否反方向播放 默認(rèn)的是 normal 如果想要反方向 就寫 alternate */
  32. /* animation-direction: alternate; */
  33. /* 動(dòng)畫結(jié)束后的狀態(tài) 默認(rèn)的是 backwards 回到起始狀態(tài) 我們可以讓他停留在結(jié)束狀態(tài) forwards */
  34. /* animation-fill-mode: forwards; */
  35. /* animation: name duration timing-function delay iteration-count direction fill-mode; */
  36. /* animation: move 2s linear 0s 1 alternate forwards; */
  37. /* 前面2個(gè)屬性 name duration 一定要寫 */
  38. /* animation: move 2s linear alternate forwards; */
  39. }
  40. div:hover {
  41. /* 鼠標(biāo)經(jīng)過div 讓這個(gè)div 停止動(dòng)畫,鼠標(biāo)離開就繼續(xù)動(dòng)畫 */
  42. animation-play-state: paused;
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. <div>
  48. </div>
  49. </body>
  50. </html>

動(dòng)畫簡(jiǎn)寫屬性

linear 勻速

animation:動(dòng)畫名稱 持續(xù)時(shí)間 運(yùn)動(dòng)曲線 何時(shí)開始 播放次數(shù) 是否反方向 動(dòng)畫起始或者結(jié)束的狀態(tài)

animation: myfirst 5s linear 2s infinite alternate;

簡(jiǎn)寫屬性里面不包含 animation-play-state

暫停動(dòng)畫:animation-play-state: puased; 經(jīng)常和鼠標(biāo)經(jīng)過等其他配合使用

想要?jiǎng)赢嬜呋貋?,而不是直接跳回來:animation-direction : alternate

盒子動(dòng)畫結(jié)束后,停在結(jié)束位置: animation-fill-mode : forwards 

大數(shù)據(jù)熱點(diǎn)圖案例

還沒聽。。


速度曲線之steps步長(zhǎng)
 

animation-timing-function:規(guī)定動(dòng)畫的速度曲線,默認(rèn)是“ease“

 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. div {
  10. overflow: hidden;
  11. font-size: 20px;
  12. width: 0;
  13. height: 30px;
  14. background-color: pink;
  15. /* 讓我們的文字強(qiáng)制一行內(nèi)顯示 */
  16. white-space: nowrap;
  17. /* steps 就是分幾步來完成我們的動(dòng)畫 有了steps 就不要在寫 ease 或者linear 了 */
  18. animation: w 4s steps(10) forwards;
  19. }
  20. @keyframes w {
  21. 0% {
  22. width: 0;
  23. }
  24. 100% {
  25. width: 200px;
  26. }
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div>世紀(jì)佳緣我在這里等你</div>
  32. </body>
  33. </html>
藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~ 希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。  分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。  藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 、平面設(shè)計(jì)服務(wù)、UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司。

CSS基礎(chǔ)學(xué)習(xí)——?jiǎng)赢?/a>

前端達(dá)人

一、CSS3 2D變形(利用Transfrom方法)

1、rotate(angle)
元素順時(shí)針旋轉(zhuǎn)給定的角度。允許負(fù)值,元素將逆時(shí)針旋轉(zhuǎn)。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    div{
        width: 100px;
        height: 100px;
        border: 1px solid red;
        transform: rotate(30deg) ;
        margin: 200px auto;
    }
</style>
<body>
    <div>

    </div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

效果如圖
在這里插入圖片描述
如果當(dāng)rotate里面的值為負(fù)數(shù)時(shí),比如ratate(-10deg),效果如圖:
在這里插入圖片描述

2、 translate(x,y)方法
通過 translate() 方法,元素從其當(dāng)前位置移動(dòng),根據(jù)給定的 left(x 坐標(biāo)) 和 top(y 坐標(biāo)) 位置參數(shù)。也就是相對(duì)于頁(yè)面左部和頂部的距離

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    div {
        width: 100px;
        height: 100px;
        border: 1px solid red;
        transform: translate(20px, 20px);
    }

</style>
<body>

    <div></div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

效果如下
在這里插入圖片描述
初次之外還有其他的參數(shù)

transform: translate(200px);
如果只帶一個(gè)參數(shù),這個(gè)參數(shù)代表的是x方向位移值,y方向位移為0

transform: translateX(200px);
對(duì)X方向移動(dòng)

transform: translateY(200px);
對(duì)Y方向移動(dòng)

3、scale() 方法
通過 scale() 方法,元素的尺寸會(huì)增加或減少,根據(jù)給定的寬度(X 軸)和高度(Y 軸)參數(shù)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    div {
        width: 100px;
        height: 100px;
        border: 1px solid red;
        transform: scale(2,0.5);
        margin: 20px auto;
    }

</style>
<body>

    <div></div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

效果如圖
在這里插入圖片描述
可以看到,長(zhǎng)邊變?yōu)榱嗽瓉淼膬杀?,寬邊變?yōu)榱嗽瓉淼?.5倍

transform: scale(1.5);x軸和y軸都放大1.5倍
transform: scaleX(1.5);x軸放大1.5倍
transform: scaleY(1.5);y軸放大1.5倍
transform-origin: left top;改變中心點(diǎn)位置為左上角,當(dāng)然還可以自由搭配,右下(right bottom),右上(right top)

4、 skew() 方法
通過 skew() 方法,元素翻轉(zhuǎn)給定的角度,根據(jù)給定的水平線(X 軸)和垂直線(Y 軸)參數(shù)。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    div {
        width: 100px;
        height: 100px;
        border: 1px solid red;
        transform: skew(30deg,30deg);
        margin: 200px auto;
    }

</style>
<body>

    <div></div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

效果如圖

在這里插入圖片描述
意思就是:圍繞 X 軸把元素翻轉(zhuǎn) 30 度,圍繞 Y 軸翻轉(zhuǎn) 30 度??赡芸雌饋肀容^抽象

transform: skew(230deg);如果只帶一個(gè)參數(shù),只有x軸方向的扭曲
transform: skewX(230deg); 對(duì)X軸進(jìn)行翻轉(zhuǎn)
transform: skewY(230deg); 對(duì)Y軸進(jìn)行翻轉(zhuǎn)

其實(shí)還是很好理解的,比如兩個(gè)圖疊加在一起

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    .demo{
        width: 200px;
        height: 200px;
        margin: 200px auto;
        border: 1px solid #000;
    }

    .box{
        width: 200px;
        height: 200px;
        border: 1px solid red;
        transform: skew(5deg,0deg);
    }

</style>
<body>
<div class="demo">
    <div class="box"></div>
</div>

</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

在這里插入圖片描述
可以看到,所謂的X軸翻轉(zhuǎn),其實(shí)就是x方向的移動(dòng),上面的線向左移動(dòng)5px,下面的線向右移動(dòng)5px,加入Y也一樣
比如:transform: skew(0deg,5deg);
在這里插入圖片描述
左邊的線向上移動(dòng)5px,右邊的線向下移動(dòng)5px,同時(shí)改變時(shí) transform: skew(5deg,5deg);

在這里插入圖片描述
最好記的方式就是對(duì)角線的同時(shí)移動(dòng),左上右下是排斥,左下右上是吸引

5、matrix() 方法
matrix() 方法把所有 2D 轉(zhuǎn)換方法組合在一起。
matrix() 方法需要六個(gè)參數(shù),包含數(shù)學(xué)函數(shù),允許您:旋轉(zhuǎn)、縮放、移動(dòng)以及傾斜元素。

如題:將div右移100px,下移200px,旋轉(zhuǎn)30度,x軸縮放1.5倍,y軸縮放2倍。

(1)transform: translate(100px, 200px) rotate(30deg) scale(1.5, 2);

(2)transform: matrix(1.299, 0.75, -1, 1.732, 100, 200)

計(jì)算方法
在這里插入圖片描述
效果如圖
在這里插入圖片描述

6、transform-origin 屬性
允許你改變被轉(zhuǎn)換元素的位置
語法: transform-origin: x-axis y-axis z-axis;
屬性值:
x-axis :定義視圖被置于 X 軸的何處。可能的值:left,center,right,length,%。
y-axis :定義視圖被置于 Y 軸的何處??赡艿闹担簍op,center,bottom,length,%。
z-axis :定義視圖被置于 Z 軸的何處??赡艿闹担簂ength。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transform-origin</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .demo{
            width: 200px;
            height: 200px;
            margin: 200px auto;
            border: 1px solid #000;
        }
        .box{
            width: 200px;
            height: 200px;
            background-color: #f00;
            transform: rotate(60deg);
            transform-origin: right bottom;
        }
    </style>
</head>
<body>
<div class="demo">
    <div class="box"></div>
</div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

效果如圖
在這里插入圖片描述
形象的來說,就是規(guī)定你從哪個(gè)角開始旋轉(zhuǎn),比如規(guī)定右下角旋轉(zhuǎn),則圖形以右下角為旋轉(zhuǎn)角,順時(shí)針旋轉(zhuǎn)60°

二、CSS3 3D變形

1、perspective屬性
perspective 屬性定義 3D 元素距視圖的距離,以像素計(jì)。該屬性允許您改變 3D 元素查看 3D 元素的視圖。
當(dāng)為元素定義 perspective 屬性時(shí),其子元素會(huì)獲得透視效果,而不是元素本身。
注釋:perspective 屬性只影響 3D 轉(zhuǎn)換元素。
語法: perspective: number|none;
屬性值:
number :元素距離視圖的距離,以像素計(jì)。
none :默認(rèn)值。與 0 相同。不設(shè)置透視

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>perspective</title>
    <style>
        .father{
            position: relative;
            width: 200px;
            height: 200px;
            padding: 10px;
            margin: 200px auto;
            border: 1px solid #999;
            perspective: 150px;
        }
        .son{
            width: 100px;
            height: 50px;
            padding: 50px;
            position: absolute;
            border: 1px solid #f00;
            background-color: #0ff;
            transform: rotateX(45deg);
        }
    </style>
</head>
<body>
<div class="father">
    <div class="son"></div>
</div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

效果如圖
在這里插入圖片描述

2、trasform-style屬性
transform-style 屬性規(guī)定如何在 3D 空間中呈現(xiàn)被嵌套的元素。
注釋:該屬性必須與 transform 屬性一同使用。
語法: transform-style: flat|preserve-3d;
屬性值:
flat :子元素將不保留其 3D 位置。
preserve-3d :子元素將保留其 3D 位置。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transform-style</title>
    <style>
        .wrapper{
            width: 200px;
            height: 100px;
            margin: 200px auto;
        }
        .div1,.div2{
            width: 200px;
            height: 100px;
            padding: 20px;
        }
        .div1{
            background-color: #f00;
            transform: rotateY(30deg);
            transform-style: preserve-3d;

        }
        .div2{
            background-color: #655fff;
            transform: rotateY(45deg);
        }
    </style>
</head>
<body>
<div class="wrapper">
    <div class="div1">div1
        <div class="div2">div2</div>
    </div>
</div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

效果如圖
在這里插入圖片描述

3、CSS3過渡
transition 屬性是一個(gè)簡(jiǎn)寫屬性,用于設(shè)置四個(gè)過渡屬性:
transition-property:規(guī)定設(shè)置過渡效果的 CSS 屬性的名稱。
transition-duration:規(guī)定完成過渡效果需要多少秒或毫秒。
transition-timing-function:規(guī)定速度效果的速度曲線。
transition-delay:定義過渡效果何時(shí)開始。
注釋:請(qǐng)始終設(shè)置 transition-duration 屬性,否則時(shí)長(zhǎng)為 0,就不會(huì)產(chǎn)生過渡效果。
語法: transition: property duration timing-function delay;

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transition過渡動(dòng)畫</title>
    <style>
        .box{
            width: 100%;
            height: 300px;
            position: relative;
            border: 1px solid #eee;
        }
        .demo{
            width: 100px;
            height: 100px;
            background-color: #f00;
            position: absolute;
            left: 100px;
            top: 100px;
            transform: rotate(0deg);
            transition-property: all;
            transition-duration: .8s;
        }
        .box:hover .demo{
            left: 500px;
            width: 300px;
            transform: rotate(45deg);
        }
    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

或者

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transition過渡動(dòng)畫</title>
    <style>
        .box{
            width: 100%;
            height: 300px;
            position: relative;
            border: 1px solid #eee;
        }
        .demo{
            width: 100px;
            height: 100px;
            background-color: #f00;
            position: absolute;
            left: 100px;
            top: 100px;
            transform: rotate(0deg);
            transition: left 2s ease 500ms, width 5s ease-in-out;
        }
        .box:hover .demo{
            left: 500px;
            width: 300px;
            transform: rotate(45deg);
        }
    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35

可以自行實(shí)驗(yàn)一下

4、CSS3動(dòng)畫

使用@keyframes
通過 @keyframes 規(guī)則,您能夠創(chuàng)建動(dòng)畫。
創(chuàng)建動(dòng)畫的原理是,將一套 CSS 樣式逐漸變化為另一套樣式。
在動(dòng)畫過程中,您能夠多次改變這套 CSS 樣式。
以百分比來規(guī)定改變發(fā)生的時(shí)間,或者通過關(guān)鍵詞 “from” 和 “to”,等價(jià)于 0% 和 100%。
0% 是動(dòng)畫的開始時(shí)間,100% 動(dòng)畫的結(jié)束時(shí)間。
為了獲得最佳的瀏覽器支持,您應(yīng)該始終定義 0% 和 100% 選擇器。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>關(guān)鍵幀動(dòng)畫</title>
    <style>
        .box{
            width: 100%;
            height: 800px;
            position: relative;
        }
        .demo{
            width: 100px;
            height: 100px;
            background-color: #ff0000;
            -webkit-border-radius: 50%;
            -moz-border-radius: 50%;
            border-radius: 50%;
            position: absolute;
            /*animation: move 5s ease-in-out infinite alternate ;*/
            -webkit-animation: move 5s ease-in-out 500ms 2 alternate ;
            -moz-animation: move 5s ease-in-out 500ms 2 alternate ;
            -ms-animation: move 5s ease-in-out 500ms 2 alternate ;
            -o-animation: move 5s ease-in-out 500ms 2 alternate ;
            animation: move 5s ease-in-out 500ms 2 alternate ;
        }
        @keyframes move {
            0%{
                left: 100px;
            }
            45%{
                left: 200px;
                top: 100px;
                background-color: #00f;
            }
            75%{
                left: 400px;
                top: 300px;
                background-color: #64ff77;
            }
            100%{
                left: 500px;
                top: 500px;
                background-color: #ff4975;
            }
        }
    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54

或者

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>關(guān)鍵幀動(dòng)畫</title>
    <style>
        .box{
            width: 100%;
            height: 800px;
            position: relative;
        }
        .demo{
            width: 100px;
            height: 100px;
            background-color: #ff0000;
            -webkit-border-radius: 50%;
            -moz-border-radius: 50%;
            border-radius: 50%;
            position: absolute;
            /*animation: move 5s ease-in-out infinite alternate ;*/
            -webkit-animation: move 5s ease-in-out 500ms 2 alternate ;
            -moz-animation: move 5s ease-in-out 500ms 2 alternate ;
            -ms-animation: move 5s ease-in-out 500ms 2 alternate ;
            -o-animation: move 5s ease-in-out 500ms 2 alternate ;
            animation: move 5s ease-in-out 500ms 2 alternate ;
        }
        @keyframes move {
           from{
                left: 100px;
            }
            to{
                left: 500px;
                background-color: #00f;
            }
        }

    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44

animation:move 5s ease-in-out 500ms 2 alternate

move:表示animation-name ,動(dòng)畫名稱

5s:表示animation-duration,時(shí)長(zhǎng)

ease-in-out:表示animation-timing-function 規(guī)定動(dòng)畫的速度曲線

除此以外還有:
linear:動(dòng)畫從頭到尾的速度是相同的。
ease:默認(rèn)。動(dòng)畫以低速開始,然后加快,在結(jié)束前變慢。
ease-in:動(dòng)畫以低速開始。
ease-out:動(dòng)畫以低速結(jié)束。
ease-in-out:動(dòng)畫以低速開始和結(jié)束。

500ms:表示animation-delay,規(guī)定在動(dòng)畫開始之前的延遲。

2 :表示animation-iteration-count,規(guī)定動(dòng)畫應(yīng)該播放的次數(shù)。

alternate:表示animation-direction,規(guī)定是否應(yīng)該輪流反向播放動(dòng)畫,如果 animation-direction 值是 “alternate”,則動(dòng)畫會(huì)在奇數(shù)次數(shù)(1、3、5 等等)正常播放,而在偶數(shù)次數(shù)(2、4、6 等等)向后播放。。



藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~

希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。 



分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。 



藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 、平面設(shè)計(jì)服務(wù)、UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司

用css畫一個(gè)空心圓環(huán),使用純CSS畫一個(gè)圓環(huán)(代碼示例)

前端達(dá)人

本篇文章通過代碼示例介紹一下使用純CSS畫圓環(huán)的方法。有一定的參考價(jià)值,有需要的朋友可以參考一下,希望對(duì)大家有所幫助。

3b98c20306e2c9d95532ec8bb7753265.png

畫圓環(huán)思想很簡(jiǎn)單:首先畫兩個(gè)圓,設(shè)置不同的背景色;然后讓兩個(gè)圓的圓心重合即可。

難度系數(shù)

☆☆

HTML

解析:此處有父容器

CSS.container {

position: relative;

top: 0;

left: 0;

width: 300px;

height: 300px;

background-color: lightgrey;

}

.ring-style {

display: inline-block;

position: absolute;

top: 50%;

left: 50%;

transform: translate(-50%, -50%);

background-color: blue;

width: 260px;

height: 260px;

border-radius: 260px;

}

.ring-style::before {

content: ' ';

display: inline-block;

position: absolute;

top: 50%;

left: 50%;

transform: translate(-50%, -50%);

background-color: white;

width: 200px;

height: 200px;

border-radius: 200px;

}

解析:設(shè)置元素的寬高、圓角效果,即可畫出一個(gè)圓

通過 ::before 偽元素和本體元素,創(chuàng)建兩個(gè)圓

通過基于父容器的絕對(duì)定位,設(shè)置 top、left、translate 屬性,讓元素基于父容器水平、豎直居中,即可讓兩個(gè)圓的圓心重合

【推薦教程:CSS視頻教程 】

效果圖

e6b5a99b91be36358f46cb9fa35bf984.png

知識(shí)點(diǎn)border-radius

::before && ::after

元素水平、豎直居中

藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~
希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。 

分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。 

藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 平面設(shè)計(jì)服務(wù)、UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司。

Echarts legend屬性使用

前端達(dá)人

Echarts的legend屬性是對(duì)圖例組件的相關(guān)配置
而legend就是Echarts圖表中對(duì)圖形的解釋部分:
圖例

其中l(wèi)egend自身常用的配置屬性如下:

orient

設(shè)置圖例的朝向

屬性值:

vertical // 垂直顯示
或者
horizontal // 水平顯示

legend: { orient: 'vertical' } 
  • 1
  • 2
  • 3

vertical

 legend: { orient: 'horizontal' } 
  • 1
  • 2
  • 3

horizontal

x/y(left/top)

設(shè)置圖例在X軸方向上的位置以及在Y軸方向上的位置

位置 取值
x/left left/center/right
y /top top/center/bottom

例子:

legend: { orient: 'vertical', x:'right', y:'center' } 
  • 1
  • 2
  • 3
  • 4
  • 5

x/y

樣式設(shè)置

屬性 說明
backgroundColor 背景顏色
borderColor 邊框顏色
borderWidth 邊框?qū)挾?
padding 內(nèi)邊距

注意:邊框?qū)挾群蛢?nèi)邊距屬性值為數(shù)值,不加單位。

legend: { orient: 'vertical', x:'center', y:'top', backgroundColor: '#fac858', borderColor: '#5470c6', borderWidth: '200', } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

echarts

itemGap

控制每一項(xiàng)的間距,也就是圖例之間的距離
屬性值為數(shù)值,不帶單位

legend: { orient: 'horizontal', x:'center', y:'top', itemGap: 40 } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

echarts

itemHeight

控制圖例圖形的高度
屬性值為數(shù)字,不加單位

legend: { orient: 'horizontal', x:'center', y:'top', itemHeight: 5 } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

echarts

textStyle

設(shè)置圖例文字樣式
屬性值為一個(gè)對(duì)象

legend: { orient: 'horizontal', x:'center', y:'top', textStyle: { color: 'red', fontSize: '20px', fontWeight: 700 } } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

echarts

selected

設(shè)置圖例的某個(gè)選項(xiàng)的數(shù)據(jù)默認(rèn)是顯示還是隱藏。
false: 隱藏
屬性值:對(duì)象,屬性值內(nèi)容:圖例上的數(shù)據(jù)與boolean構(gòu)成鍵值對(duì)
如果某選項(xiàng)設(shè)置為false,那么圖標(biāo)上的數(shù)據(jù)也會(huì)默認(rèn)不顯示,而圖例會(huì)以灰色樣式顯示

legend: { orient: 'horizontal', x:'center', y:'top', selected:{ '搜索引擎': false, '聯(lián)盟廣告': false } } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

echarts

data

圖例上顯示的文字信息,如果不設(shè)置該項(xiàng),默認(rèn)會(huì)以series設(shè)置的信息作為圖例信息。如果設(shè)置該項(xiàng),必須與series設(shè)置的信息一致,才會(huì)生效。
而該屬性的作用:可以單獨(dú)對(duì)圖例中某個(gè)選項(xiàng)進(jìn)行單獨(dú)設(shè)置樣式
比如:

legend: { orient: 'horizontal', x:'center', y:'top', data:[{ name: '搜索引擎', icon: 'circle', textStyle: {fontWeight: 'bold', color: 'orange'} },'直接訪問','郵件營(yíng)銷','聯(lián)盟廣告','視頻廣告'] } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

以上單獨(dú)設(shè)置中
name:指定該項(xiàng)的名稱,必填
icon:指定圖例項(xiàng)的icon,可以為內(nèi)置的圖形7個(gè)圖形,或者自定義圖標(biāo)的形式:'image://url'
textStyle::設(shè)置文本樣式
echarts





藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~

希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。 



分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。 



藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 、平面設(shè)計(jì)服務(wù)UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司。

超詳細(xì)的VSCode下載和安裝教程以及解決VSCode下載速度特別慢的問題

前端達(dá)人

1. 引言

今天用WebStorm運(yùn)行前端代碼時(shí),發(fā)現(xiàn)不太好打斷點(diǎn)。

于是,打算改用VSCode來運(yùn)行前端代碼,但前提是要安裝VSCode,如下便是超詳細(xì)的VSCode安裝教程以及解決VSCode下載速度特別慢的問題。

2. 下載VSCode

  1. 打開VSCode官網(wǎng)

https://code.visualstudio.com

在這里插入圖片描述

  1. download下載

在這里插入圖片描述

在這里插入圖片描述

  1. 下載特別慢
    在這里插入圖片描述

你會(huì)發(fā)現(xiàn)VSCode官網(wǎng)地址下載很慢,或者下著下著就暫停了,如下圖所示:

在這里插入圖片描述

如果下載完成,那得等到猴年馬月。

3. 解決VSCode下載速度特別慢

  1. 單擊右下角全部顯示

我是用chrome瀏覽器,點(diǎn)擊右下角的全部顯示按鈕,可以跳轉(zhuǎn)到下載內(nèi)容頁(yè)面。

如果你是用其他瀏覽器,可能使用其他方式跳轉(zhuǎn)到下載內(nèi)容頁(yè)面。

在這里插入圖片描述

在這里插入圖片描述

  1. 鼠標(biāo)放置在下圖紅框中,右鍵鼠標(biāo),復(fù)制鏈接地址

在這里插入圖片描述

  1. 將復(fù)制號(hào)的下載鏈接地址放到任意地方,并將藍(lán)色區(qū)域的地址替換成國(guó)內(nèi)鏡像地址:vscode.cdn.azure.cn

在這里插入圖片描述

https://az764295.vo.msecnd.net/stable/129500ee4c8ab7263461ffe327268ba56b9f210d/VSCodeUserSetup-x64-1.72.1.exe修改為https://vscode.cdn.azure.cn/stable/129500ee4c8ab7263461ffe327268ba56b9f210d/VSCodeUserSetup-x64-1.72.1.exe

將替換后的地址輸入到瀏覽器的地址欄中,如下圖所示,按enter鍵即可快速下載。

在這里插入圖片描述

在這里插入圖片描述

速度是不是立刻提升了。

4. 安裝VSCode

  1. 我同意此協(xié)議 -> 下一步

在這里插入圖片描述

  1. 選擇更換文件夾 -> 下一步

因?yàn)槲业?code style="box-sizing:border-box;outline:0px;user-select:text !important;font-family:"font-size:14px;line-height:22px;color:#C7254E;background-color:#F9F2F4;border-radius:2px;padding:2px 4px;overflow-wrap:break-word;">系統(tǒng)盤(C盤)的內(nèi)存不夠用了,需要更換到其他盤符,我更換到D盤中。

如果你不想更換到其他盤符,可以直接下一步即可。

在這里插入圖片描述

在這里插入圖片描述

  1. 選擇附加任務(wù) -> 下一步。根據(jù)你的需求勾選復(fù)選框。

在這里插入圖片描述

  1. 準(zhǔn)備安裝 -> 安裝

在這里插入圖片描述

在這里插入圖片描述

  1. 安裝完成 -> 完成

在這里插入圖片描述

  1. 打開VSCode

在這里插入圖片描述





藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~

希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。 



分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。 



藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 平面設(shè)計(jì)服務(wù)、UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司。

HBuilderX uni-app簡(jiǎn)單實(shí)現(xiàn)靜態(tài)登錄頁(yè)面(實(shí)例)

前端達(dá)人

本章用到......uni-app頁(yè)面跳轉(zhuǎn)uni.navigateTo方法、uni.navigateBack方法。uni-app簡(jiǎn)單實(shí)現(xiàn)郵箱驗(yàn)證碼發(fā)送點(diǎn)擊后讀秒樣式。登錄賬號(hào)、密碼正則表達(dá)式驗(yàn)證等

適合剛?cè)腴T的小伙伴,大佬就沒必要看了

靜態(tài)頁(yè)面!靜態(tài)頁(yè)面!沒有綁定后端數(shù)據(jù)接口

目錄

一、HBuilderX下載

二、創(chuàng)建uni-app項(xiàng)目

pages.json配置文件

三、登錄頁(yè)面

 login.vue頁(yè)面

login.css文件

四、手機(jī)短信驗(yàn)證頁(yè)面

 phoneVerify.vue頁(yè)面

 phoneVerify.css文件

五、找回密碼頁(yè)面

findBack.vue頁(yè)面

findBack.css文件

六、郵箱找回密碼頁(yè)面

 mailFandBack.vue頁(yè)面

mailFandBack.css文件

七、郵箱發(fā)送驗(yàn)證成功頁(yè)面

 emailFinish.vue頁(yè)面

emailFinish.css文件


一、HBuilderX下載

https://dcloud.io/hbuilderx.html

 官網(wǎng)直接下載解壓即可

二、創(chuàng)建uni-app項(xiàng)目

文件-新建-項(xiàng)目

 我這里直接選擇默認(rèn)模板,Vue版本、uniCloud自行選擇即可

 創(chuàng)建完成后自動(dòng)生成文件夾

 文件名這里自動(dòng)生成原本是index,文件名自行定義即可

頁(yè)面文件自己新建Vue文件即可

pages.json配置文件

注意!!這個(gè)文件后續(xù)如果需要新添加新頁(yè)面時(shí)這個(gè)文件里一定要配置參數(shù)不然頁(yè)面出不來,代碼格式看下面代碼↓↓↓↓↓↓↓↓↓


  1. {
  2. // 設(shè)置單頁(yè)面
  3. "pages": [ //pages數(shù)組中第一項(xiàng)表示應(yīng)用啟動(dòng)頁(yè),參考:https://uniapp.dcloud.io/collocation/pages
  4. {
  5. "path": "pages/login/login",
  6. "style": {
  7. // 設(shè)置頂部導(dǎo)航欄
  8. "navigationBarTitleText": "",
  9. "navigationBarBackgroundColor": "#FFFFFF"
  10. }
  11. },
  12. {
  13. "path": "pages/login/findBack",
  14. "style": {
  15. "navigationBarTitleText": "找回密碼"
  16. }
  17. },
  18. {
  19. "path": "pages/login/mailFindBack",
  20. "style": {
  21. "navigationBarTitleText": "郵箱找回密碼"
  22. }
  23. },
  24. {
  25. "path": "pages/login/phoneVerify",
  26. "style": {
  27. "navigationBarTitleText": "",
  28. "navigationBarBackgroundColor": "#FFFFFF"
  29. }
  30. },
  31. {
  32. "path": "pages/login/emailFinish",
  33. "style": {
  34. "navigationBarTitleText": ""
  35. }
  36. }
  37. {
  38. //新添加的Vue頁(yè)面配置?。?!
  39. "path": "",
  40. "style": {
  41. "navigationBarTitleText": ""
  42. }
  43. }
  44. ],
  45. // 設(shè)置全部頁(yè)面
  46. "globalStyle": {
  47. "navigationBarTextStyle": "black",
  48. "navigationBarTitleText": "uni-app",
  49. "navigationBarBackgroundColor": "#F8F8F8",
  50. "backgroundColor": "#F8F8F8"
  51. },
  52. "uniIdRouter": {},
  53. // 設(shè)置底部導(dǎo)航欄
  54. "tabBar": {
  55. }
  56. }

類似navigationBarTitleText(導(dǎo)航欄text)、navigationBarBackgroundColor(導(dǎo)航欄背景色)等等屬性可以查看相關(guān)資料自行配置即可

pages里設(shè)置單頁(yè)面參數(shù),每個(gè)頁(yè)面配置對(duì)應(yīng)path路徑參數(shù)

globalStyle里設(shè)置全局頁(yè)面參數(shù)

js、josn、scss文件等等其他配置文件這里就不多說了自行研究吧?。?!因?yàn)槲乙策€沒搞清楚到底怎么用哈哈哈

進(jìn)入正題↓↓↓↓↓↓↓↓↓↓↓↓↓代碼看著有些亂........湊合看慢慢理解吧

代碼里的src圖片鏈接自行修改?。。。。ㄟ€有css里的URL)

三、登錄頁(yè)面

先看一下效果圖

 login.vue頁(yè)面


  1. <!-- 登錄頁(yè)面 -->
  2. <template>
  3. <view class="flex-col flex-auto group">
  4. <text class="self-center text_2" v-if="type==1000">手機(jī)號(hào)登錄</text>
  5. <text class="self-center text_2" v-if="type==2000">賬號(hào)登錄</text>
  6. <!-- 手機(jī)號(hào)登錄 -->
  7. <view class="" v-if="type==1000">
  8. <view class="flex-col justify-start items-start text-wrapper">
  9. <input type="text" class="font_1" @input="onInput" placeholder="請(qǐng)輸入手機(jī)號(hào)" v-model="phoneNumber">
  10. </view>
  11. <!-- svg畫線 -->
  12. <view style="height: 1px;">
  13. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  14. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  15. </svg>
  16. </view>
  17. <view class="flex-col justify-start items-start text-wrapper_2">
  18. <input type="text" password="true" class="font_1" @input="onInput" placeholder="請(qǐng)輸入密碼" v-model="phonePassword">
  19. </view>
  20. <!-- svg畫線 -->
  21. <view style="height: 1px;">
  22. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  23. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  24. </svg>
  25. </view>
  26. </view>
  27. <!-- 賬號(hào)登錄 -->
  28. <view class="" v-if="type==2000">
  29. <view class="flex-col justify-start items-start text-wrapper">
  30. <input type="text" class="font_1" @input="onInput" placeholder="請(qǐng)輸入用戶名" v-model="idNumber">
  31. </view>
  32. <!-- svg畫線 -->
  33. <view style="height: 1px;">
  34. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  35. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  36. </svg>
  37. </view>
  38. <view class="flex-col justify-start items-start text-wrapper_2">
  39. <input type="text" password="true" class="font_1" @input="onInput" placeholder="請(qǐng)輸入用戶密碼" v-model="idPassword">
  40. </view>
  41. <!-- svg畫線 -->
  42. <view style="height: 1px;">
  43. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  44. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  45. </svg>
  46. </view>
  47. </view>
  48. <view class="self-start font_1 text_3" @click="type=2000" v-if="type==1000">用賬號(hào)登錄</view>
  49. <view class="self-start font_1 text_3" @click="type=1000" v-if="type==2000">用手機(jī)號(hào)登錄</view>
  50. <!-- 登錄按鈕1 -->
  51. <view class="flex-col justify-start items-center button" v-if="btnShow">
  52. <button class="font_1 text_4" @click="onSubmit">登 錄</button>
  53. </view>
  54. <!-- 登錄按鈕2 -->
  55. <view class="flex-col justify-start items-center button2" v-else>
  56. <button class="font_1 text_66">登 錄</button>
  57. </view>
  58. <view class="flex-row justify-between group_2" v-if="type==1000">
  59. <text class="font_2" @click="onPageJump('/pages/login/phoneVerify')">短信驗(yàn)證碼登錄</text>
  60. <text class="font_2" @click="onPageJump('/pages/login/findBack')">找回密碼</text>
  61. </view>
  62. <view class="flex-row justify-between group_3" v-else>
  63. <text class="font_2" @click="onPageJump('/pages/login/findBack')">找回密碼</text>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. export default {
  69. components:{
  70. },
  71. data() {
  72. return {
  73. type: 1000, //判斷登錄類型手機(jī)登錄或賬號(hào)登錄
  74. phoneNumber:'', //手機(jī)賬號(hào)
  75. phonePassword:'', //手機(jī)密碼
  76. idNumber:'', //賬號(hào)
  77. idPassword:'', //賬號(hào)密碼
  78. btnShow:false, //判斷登錄按鈕顯示隱藏
  79. timeOut:null, //添加定時(shí)器
  80. }
  81. },
  82. onLoad() {
  83. },
  84. created() {
  85. },
  86. // 方法
  87. methods: {
  88. // 找回密碼跳轉(zhuǎn)頁(yè)面
  89. onPageJump(url) {
  90. uni.navigateTo({
  91. url: url
  92. });
  93. },
  94. // 判斷顯示登錄按鈕
  95. onInput() {
  96. this.timeOut && clearTimeout(this.timeOut)
  97. this.timeOut = setTimeout(() => {
  98. if (this.type == 1000) {
  99. if (this.phoneNumber && this.phonePassword) {
  100. this.btnShow = true;
  101. } else {
  102. this.btnShow = false;
  103. }
  104. } else {
  105. if (this.idNumber && this.idPassword) {
  106. this.btnShow = true;
  107. } else {
  108. this.btnShow = false;
  109. }
  110. }
  111. }, 100);
  112. },
  113. // 點(diǎn)擊登錄
  114. onSubmit(){
  115. // 判斷登錄方式為手機(jī)號(hào)登錄
  116. if(this.type==1000){
  117. // 判斷驗(yàn)證手機(jī)號(hào)
  118. if(!this.phoneNumber){
  119. uni.showToast({
  120. title: '請(qǐng)輸入手機(jī)號(hào)',
  121. icon: 'none',
  122. });
  123. return;
  124. }
  125. const phoneNumber= /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
  126. if(!phoneNumber.test(this.phoneNumber)){
  127. uni.showToast({
  128. title: '手機(jī)號(hào)輸入不正確',
  129. icon: 'none',
  130. });
  131. return;
  132. }
  133. // 判斷驗(yàn)證手機(jī)密碼
  134. if(!this.phonePassword){
  135. uni.showToast({
  136. title: '請(qǐng)輸入密碼',
  137. icon: 'none',
  138. });
  139. return;
  140. }
  141. uni.showToast({
  142. title: '正在登錄',
  143. icon: 'loading',
  144. });
  145. }else{
  146. // 判斷驗(yàn)證賬號(hào)
  147. if(!this.idNumber){
  148. uni.showToast({
  149. title: '請(qǐng)輸入賬號(hào)',
  150. icon: 'none',
  151. });
  152. return;
  153. }
  154. // 判斷驗(yàn)證賬號(hào)密碼
  155. if(!this.idPassword){
  156. uni.showToast({
  157. title: '請(qǐng)輸入賬號(hào)密碼',
  158. icon: 'none',
  159. });
  160. return;
  161. }
  162. uni.showToast({
  163. title: '正在登錄',
  164. icon: 'loading',
  165. });
  166. }
  167. },
  168. }
  169. }
  170. </script>
  171. <style>
  172. @import"../../style/css/login.css";
  173. </style>

一個(gè)小tips:

先說一下這個(gè)頁(yè)面↑↑↑↑↑↑↑↑↑↑↑↑↑↑

svg因?yàn)槲疫@里賬號(hào)、密碼input輸入框的border邊框要設(shè)置成小數(shù)1px以下0.1px、0.2px、0.3px等等,所以這里用了svg的畫圖,如果有小伙伴碰到同樣問題可以參考一下,不需要的直接style里直接設(shè)置border參數(shù)即可

uni.showToast是uni-app彈出框的方法直接用就行,參數(shù)么。。自己研究研究就行   (例:icon圖標(biāo)參數(shù)有四種類型none、loading、success、error)

style外部引用css樣式直接用@import相對(duì)路徑即可

login.css文件

style樣式最好還是用自己寫的就別直接復(fù)制了,我這里用的是平臺(tái)自動(dòng)生成的所以比較亂隨便看看就行了看多了頭疼(僅供參考全局樣式可以直接略過)


  1. /************************************************************
  2. ** 全局樣式 ** **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. /* ---------------------------------------------------------------------- */
  102. .group {
  103. padding: 20px 40px 10px;
  104. overflow-y: auto;
  105. }
  106. .text_2 {
  107. color: #020202;
  108. font-size: 20px;
  109. font-family: 'PingFang SC';
  110. line-height: 28px;
  111. text-align: center;
  112. }
  113. .text-wrapper {
  114. margin-top: 42px;
  115. padding-bottom: 12px;
  116. /* border-bottom: solid 1px #888888; */
  117. }
  118. .font_1 {
  119. width: 100%;
  120. font-size: 15px;
  121. font-family: 'PingFang SC';
  122. line-height: 21px;
  123. color: #00000;
  124. }
  125. .text-wrapper_2 {
  126. padding: 20px 0 12px;
  127. /* border-bottom: solid 1px #888888; */
  128. }
  129. .text_3 {
  130. margin-top: 22px;
  131. color: #166bf8;
  132. }
  133. /* 登錄按鈕1 */
  134. .button button {
  135. margin-top: 324px;
  136. padding: 8px 0 11px;
  137. /* background-color: #166bf880; */
  138. background-image: url('。。。。。。。。。。。。。。。。。。。。');
  139. background-size: 100% 100%;
  140. background-repeat: no-repeat;
  141. border-radius: 5px;
  142. width: 100%;
  143. }
  144. .text_4 {
  145. color: #ffffff;
  146. }
  147. .group_2 {
  148. padding: 50px 62px;
  149. }
  150. .group_3 {
  151. padding: 50px 42%;
  152. }
  153. .font_2 {
  154. font-size: 12px;
  155. font-family: 'PingFang SC';
  156. line-height: 17px;
  157. color: #555555;
  158. }
  159. /* 登錄按鈕2*/
  160. .button2 button{
  161. width: 100%;
  162. margin-top: 324px;
  163. padding: 8px 0 11px;
  164. background-color: #166bf880;
  165. border-radius: 5px;
  166. line-height: 21px;
  167. font-size: 15px;
  168. }
  169. .text_66 {
  170. color: #ffffff;
  171. }

四、手機(jī)短信驗(yàn)證頁(yè)面

點(diǎn)擊登錄頁(yè)面上的短信驗(yàn)證碼登錄后跳轉(zhuǎn)到此頁(yè),跳轉(zhuǎn)方法會(huì)用到uni.navigateTo方法在登錄頁(yè)面看代碼自行理解吧↑↑↑↑↑↑↑↑↑↑↑

跳轉(zhuǎn)、返回的方法參考文檔:

https://www.bookstack.cn/read/uniapp-api/spilt.5.ead34267bd06d88a.mdhttps://www.bookstack.cn/read/uniapp-api/spilt.5.ead34267bd06d88a.md

注意?。√砑有马?yè)面的時(shí)候上面的↑↑↑↑↑↑↑↑↑↑↑pages.json配置文件也需要添加對(duì)應(yīng)的頁(yè)面配置才行不然頁(yè)面出不來

效果圖:

 phoneVerify.vue頁(yè)面


  1. <!-- 手機(jī)驗(yàn)證找回密碼 -->
  2. <template>
  3. <view class="flex-col flex-auto group">
  4. <text class="self-center text_2">手機(jī)號(hào)+短信驗(yàn)證碼登錄</text>
  5. <view class="flex-col group_2 space-y-10">
  6. <input type="number" class="self-start font_1" @input="onInput" placeholder="請(qǐng)輸入手機(jī)號(hào)碼" v-model="phoneNumber">
  7. <!-- svg畫線 -->
  8. <view style="height: 1px;">
  9. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  10. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  11. </svg>
  12. </view>
  13. <view class="flex-row justify-between group_3">
  14. <input type="number" class="self-start font_1 text_4" maxlength="6" @input="onInput" placeholder="請(qǐng)輸入驗(yàn)證碼" v-model="code">
  15. <view class="flex-col justify-start items-center self-center text-wrapper">
  16. <!-- <text class="font_1 text_3" @click="onSetCode()">獲取驗(yàn)證碼</text> -->
  17. <text v-bind:class="{acquire:isGrey,again:!isGrey}"
  18. v-bind:disabled="dis" type="primary"
  19. @click="onSetCode">
  20. <span v-if="show">獲取驗(yàn)證碼</span>
  21. <span v-else>重新發(fā)送({{count}}s)</span>
  22. </text>
  23. </view>
  24. </view>
  25. <!-- svg畫線 -->
  26. <view style="height: 1px;">
  27. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  28. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  29. </svg>
  30. </view>
  31. </view>
  32. <view class="self-start font_1 text_5" @click="onPageJump('/pages/login/login')">用密碼登錄</view>
  33. <view class="flex-col justify-start items-center button" v-if="btnShow">
  34. <button class="font_1 text_6" @click="onSubmit()">登 錄</button>
  35. </view>
  36. <!-- 登錄按鈕2 -->
  37. <view class="flex-col justify-start items-center button2" v-else>
  38. <button class="font_1 text_66">登 錄</button>
  39. </view>
  40. <text class="self-center text_7" @click="onPageJump('/pages/login/findBack')">找回密碼</text>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. components: {
  46. },
  47. data() {
  48. return {
  49. phoneNumber:'', //手機(jī)號(hào)驗(yàn)證
  50. code:'', //驗(yàn)證碼
  51. dis: false, //判斷是否禁用狀態(tài)
  52. show: true, //判斷顯示為發(fā)送還是重新發(fā)送
  53. isGrey: false, //class判斷按鈕樣式
  54. timer: null, //設(shè)置計(jì)時(shí)器,
  55. count: "", //定義常量
  56. num:'', //判斷是否為第一次點(diǎn)擊
  57. btnShow:false, //判斷登錄按鈕顯示隱藏
  58. timeOut:null, //添加定時(shí)器
  59. };
  60. },
  61. // 方法
  62. methods: {
  63. // 找回密碼跳轉(zhuǎn)頁(yè)面
  64. onPageJump(url) {
  65. uni.navigateTo({
  66. url: url
  67. });
  68. },
  69. // 發(fā)送驗(yàn)證碼
  70. onSetCode() {
  71. let TIME_COUNT = 60;
  72. if (!this.timer) {
  73. uni.showToast({
  74. title: '已發(fā)送驗(yàn)證碼',
  75. icon: 'success',
  76. });
  77. this.count = TIME_COUNT;
  78. this.isGrey = true;
  79. this.show = false;
  80. this.dis = true;
  81. this.timer = setInterval(() => {
  82. if (this.count > 0 && this.count <= TIME_COUNT) {
  83. this.count--;
  84. } else {
  85. this.dis = false;
  86. this.isGrey = false;
  87. this.show = true;
  88. clearInterval(this.timer);
  89. this.timer = null;
  90. }
  91. }, 1000);
  92. }
  93. },
  94. // 判斷顯示登錄按鈕
  95. onInput() {
  96. this.timeOut && clearTimeout(this.timeOut)
  97. this.timeOut = setTimeout(() => {
  98. if (this.phoneNumber && this.code) {
  99. this.btnShow = true;
  100. } else {
  101. this.btnShow = false;
  102. }
  103. }, 100);
  104. },
  105. //點(diǎn)擊登錄
  106. onSubmit(){
  107. // 判斷驗(yàn)證手機(jī)號(hào)
  108. if(!this.phoneNumber){
  109. uni.showToast({
  110. title: '請(qǐng)輸入手機(jī)號(hào)',
  111. icon: 'none',
  112. });
  113. return;
  114. }
  115. const phoneNumber= /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
  116. if(!phoneNumber.test(this.phoneNumber)){
  117. uni.showToast({
  118. title: '手機(jī)號(hào)輸入不正確',
  119. icon: 'none',
  120. });
  121. return;
  122. }
  123. // 判斷驗(yàn)證碼
  124. if(!this.code){
  125. uni.showToast({
  126. title: '請(qǐng)輸入驗(yàn)證碼',
  127. icon: 'none',
  128. });
  129. return;
  130. }
  131. uni.showToast({
  132. title: '請(qǐng)稍后...',
  133. icon: 'loading',
  134. });
  135. },
  136. },
  137. };
  138. </script>
  139. <style>
  140. @import"../../style/css/phoneVerify.css";
  141. /* 驗(yàn)證碼按鈕樣式 */
  142. .acquire{
  143. padding: 3px 0px;
  144. background-color: #eeeeee;
  145. border-radius: 5px;
  146. width: 92px;
  147. height: 29px;
  148. color: #666;
  149. font-size: 14px;
  150. line-height: 20px;
  151. text-align: center;
  152. }
  153. .again{
  154. padding: 3px 0px;
  155. background-color: #eeeeee;
  156. border-radius: 5px;
  157. width: 92px;
  158. height: 29px;
  159. color: #000000;
  160. font-size: 14px;
  161. line-height: 20px;
  162. text-align: center;
  163. }
  164. </style>

這個(gè)頁(yè)面因?yàn)槭庆o態(tài)的沒有后端接口只是做的樣式,所以驗(yàn)證碼讀秒這塊內(nèi)容刷新頁(yè)面時(shí)會(huì)重置重新開始讀秒這里注意一下就行,如果接后端接口實(shí)現(xiàn)的話原理也差不多自己慢慢理解就行

大概就長(zhǎng)這樣:

至于左上角這個(gè)返回鍵的小鈕鈕是uni-app創(chuàng)建項(xiàng)目時(shí)自帶的 pages.json配置文件可以配置關(guān)閉 用("navigationStyle":"custom")這個(gè)參數(shù)就能關(guān)閉,單頁(yè)面關(guān)閉在pages里配置,全部關(guān)閉在globalStyle里配置。

大概長(zhǎng)這樣:

也可以在Vue頁(yè)面的方法里用uni.navigateBack方法自己寫一個(gè)返回的方法。uni.navigateBack返回頁(yè)面的方法具體怎么用↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓后面的頁(yè)面會(huì)有用到

 phoneVerify.css文件


  1. /************************************************************
  2. ** 全局樣式 **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. /* ------------------------------------------------ */
  102. .group {
  103. padding: 30px 40px 60px;
  104. overflow-y: auto;
  105. }
  106. .text_2 {
  107. color: #020202;
  108. font-size: 20px;
  109. font-family: 'PingFang SC';
  110. line-height: 28px;
  111. }
  112. .group_2 {
  113. margin-top: 42px;
  114. /* border-bottom: solid 1px #888888; */
  115. }
  116. .space-y-10 > view:not(:first-child),
  117. .space-y-10 > text:not(:first-child),
  118. .space-y-10 > image:not(:first-child) {
  119. margin-top: 10px;
  120. }
  121. .font_1 {
  122. font-size: 15px;
  123. font-family: 'PingFang SC';
  124. line-height: 21px;
  125. color: #000000;
  126. }
  127. .group_3 {
  128. padding: 5px 0;
  129. /* border-top: solid 1px #888888; */
  130. }
  131. .text_4 {
  132. margin-top: 8px;
  133. }
  134. .text-wrapper {
  135. padding: 4px 0;
  136. background-color: #eeeeee;
  137. border-radius: 5px;
  138. width: 92px;
  139. height: 29px;
  140. }
  141. .text_3 {
  142. color: #000000;
  143. font-size: 14px;
  144. line-height: 20px;
  145. }
  146. .text_5 {
  147. margin-top: 22px;
  148. color: #166bf8;
  149. }
  150. .button button{
  151. margin-top: 324px;
  152. padding: 8px 0 11px;
  153. /* background-color: #166bf880; */
  154. background-image: url('。。。。。。。。。。。。。。。。。。。。。。');
  155. background-size: 100% 100%;
  156. background-repeat: no-repeat;
  157. border-radius: 5px;
  158. width: 100%;
  159. }
  160. .text_6 {
  161. color: #ffffff;
  162. }
  163. .text_7 {
  164. margin-top: 50px;
  165. color: #555555;
  166. font-size: 12px;
  167. font-family: 'PingFang SC';
  168. line-height: 17px;
  169. }
  170. /* 登錄按鈕2*/
  171. .button2 button{
  172. width: 100%;
  173. margin-top: 324px;
  174. padding: 8px 0 11px;
  175. background-color: #166bf880;
  176. border-radius: 5px;
  177. line-height: 21px;
  178. font-size: 15px;
  179. }
  180. .text_66 {
  181. color: #ffffff;
  182. }

五、找回密碼頁(yè)面

在登錄頁(yè)面點(diǎn)擊找回密碼后跳轉(zhuǎn)到此頁(yè)面

同樣在pages.json文件里配置對(duì)應(yīng)頁(yè)面參數(shù)↑↑↑↑↑↑↑↑↑

效果圖:

 點(diǎn)擊通過手機(jī)號(hào)跳轉(zhuǎn)到手機(jī)短信驗(yàn)證頁(yè)面 也就是第四步的頁(yè)面點(diǎn)擊通過郵箱驗(yàn)證跳轉(zhuǎn)到郵箱驗(yàn)證頁(yè)面 也就是第六步的頁(yè)面

findBack.vue頁(yè)面


  1. <!-- 找回密碼 -->
  2. <template>
  3. <view class="flex-col justify-start flex-auto group_3">
  4. <view class="flex-col section">
  5. <view class="flex-row justify-between items-center group_4" @click="onPageJump('/pages/login/phoneVerify')">
  6. <text class="font_1">通過已綁定手機(jī)號(hào),用短信驗(yàn)證登錄</text>
  7. <image
  8. class="image_5"
  9. src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/637d8bf95a7e3f031010c80e/63e351ec66570000128a304a/16758423632990405565.png"
  10. />
  11. </view>
  12. <view class="flex-row justify-between items-center group_4" @click="onPageJump('/pages/login/mailFindBack')">
  13. <text class="font_1">通過已綁定郵箱重設(shè)密碼</text>
  14. <image
  15. class="image_5"
  16. src="。。。。。。。。。。。。。。。"
  17. />
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. components: {},
  25. data() {
  26. return {
  27. };
  28. },
  29. methods: {
  30. onPageJump(url) {
  31. uni.navigateTo({
  32. url:url
  33. })
  34. },
  35. },
  36. };
  37. </script>
  38. <style>
  39. @import"../../style/css/findBack.css";
  40. </style>

findBack.css文件


  1. /************************************************************
  2. ** 全局樣式 **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. .font_1 {
  102. font-size: 16px;
  103. font-family: 'PingFang SC';
  104. line-height: 22px;
  105. color: #020202;
  106. }
  107. .group_3 {
  108. padding: 10px 0 586px;
  109. overflow-y: auto;
  110. }
  111. .section {
  112. padding: 0px 16px;
  113. background-color: #ffffff;
  114. }
  115. .group_4 {
  116. padding: 18px 0;
  117. border-bottom: solid 1px #979797;
  118. }
  119. .image_5 {
  120. margin-right: 14px;
  121. width: 12px;
  122. height: 12px;
  123. }

六、郵箱找回密碼頁(yè)面

效果圖:

 mailFandBack.vue頁(yè)面


  1. <!-- 郵件找回密碼 -->
  2. <template>
  3. <view class="flex-col flex-auto group">
  4. <text class="self-center text_2">通過郵箱找回密碼</text>
  5. <input type="text" class="self-start font_1 text_3" @input="onInput" placeholder="請(qǐng)輸入您綁定的郵箱地址" v-model="email">
  6. <!-- svg畫線 -->
  7. <view style="height: 1px;">
  8. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  9. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  10. </svg>
  11. </view>
  12. <view class="flex-col justify-start items-center button" v-if="btnShow">
  13. <text class="font_1 text_4" @click="onSubmit()">下一步</text>
  14. </view>
  15. <!-- 下一步按鈕2 -->
  16. <view class="flex-col justify-start items-center button2" v-else>
  17. <button class="font_1 text_66">下一步</button>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. components: {
  24. },
  25. data() {
  26. return {
  27. email:'', //郵箱
  28. btnShow:false, //判斷登錄按鈕顯示隱藏
  29. timeOut:null, //添加定時(shí)器
  30. };
  31. },
  32. methods: {
  33. // 判斷顯示下一步按鈕
  34. onInput() {
  35. this.timeOut && clearTimeout(this.timeOut)
  36. this.timeOut = setTimeout(() => {
  37. if (this.email) {
  38. this.btnShow = true;
  39. } else {
  40. this.btnShow = false;
  41. }
  42. }, 100);
  43. },
  44. // 點(diǎn)擊下一步
  45. onSubmit(){
  46. if(!this.email){
  47. uni.showToast({
  48. title: '請(qǐng)輸入郵箱',
  49. icon: 'none',
  50. });
  51. return;
  52. }
  53. const email= /^\w{3,}@\w{2,}\.(com|cn|net|com\.cn)$/;
  54. if(!email.test(this.email)){
  55. uni.showToast({
  56. title: '郵箱輸入不正確',
  57. icon: 'none',
  58. });
  59. return;
  60. }
  61. uni.showToast({
  62. title: '請(qǐng)稍后...',
  63. icon: 'loading',
  64. });
  65. // 添加定時(shí)器延時(shí)跳轉(zhuǎn)頁(yè)面
  66. setTimeout(function(){
  67. uni.navigateTo({
  68. url: '/pages/login/emailFinish'
  69. });
  70. },2000)
  71. }
  72. },
  73. };
  74. </script>
  75. <style>
  76. @import"../../style/css/mailFindBack.css";
  77. </style>

mailFandBack.css文件


  1. /************************************************************
  2. ** 全局樣式 **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. /* ------------------------------------------------------------------------------ */
  102. .group {
  103. padding: 25px 40px 127px;
  104. overflow-y: auto;
  105. }
  106. .text_2 {
  107. color: #020202;
  108. font-size: 20px;
  109. font-family: 'PingFang SC';
  110. line-height: 28px;
  111. }
  112. .font_1 {
  113. font-size: 15px;
  114. font-family: 'PingFang SC';
  115. line-height: 21px;
  116. }
  117. .text_3 {
  118. margin-top: 42px;
  119. margin-bottom: 12px;
  120. color: #999999;
  121. }
  122. /* .section {
  123. margin-top: 12px;
  124. background-color: #888888;
  125. height: 1px;
  126. } */
  127. .button {
  128. margin-top: 324px;
  129. padding: 8px 0 11px;
  130. /* background-color: #166bf880; */
  131. background-image: url('。。。。。。。。。。。。');
  132. background-size: 100% 100%;
  133. background-repeat: no-repeat;
  134. border-radius: 5px;
  135. }
  136. .text_4 {
  137. color: #ffffff;
  138. }
  139. /* 下一步按鈕2*/
  140. .button2 button{
  141. width: 100%;
  142. margin-top: 324px;
  143. padding: 8px 0 11px;
  144. background-color: #166bf880;
  145. border-radius: 5px;
  146. line-height: 21px;
  147. font-size: 15px;
  148. }
  149. .text_66 {
  150. color: #ffffff;
  151. }

七、郵箱發(fā)送驗(yàn)證成功頁(yè)面

效果圖:

 emailFinish.vue頁(yè)面


  1. <template>
  2. <view class="flex-col flex-auto group">
  3. <view class="flex-col group_2">
  4. <image
  5. class="self-center image_5"
  6. src="。。。。。。。。。。。。。。"
  7. />
  8. <text class="self-center text_2">請(qǐng)?jiān)L問郵件中給出的網(wǎng)頁(yè)鏈接地址,根據(jù)頁(yè)面提示完成密碼重設(shè)。</text>
  9. <view class="flex-col justify-start items-center button">
  10. <button class="text_3" @click="Back">確定</button>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. components: {
  18. },
  19. data() {
  20. return {
  21. };
  22. },
  23. methods: {
  24. // 點(diǎn)擊確定返回上一頁(yè)
  25. Back(){
  26. // 返回到上一個(gè)頁(yè)面
  27. uni.navigateBack({
  28. delta:1,//返回層數(shù),2則上上頁(yè),默認(rèn)delta:1
  29. })
  30. },
  31. },
  32. };
  33. </script>
  34. <style>
  35. @import"../../style/css/emailFinish.css";
  36. </style>

點(diǎn)擊返回上一頁(yè)面可以用uni.navigateBack方法

點(diǎn)擊跳轉(zhuǎn)到指定頁(yè)面可以用uni.navigateTo方法(因?yàn)槎紝儆谔D(zhuǎn)頁(yè)面也可以用這個(gè)方法返回上一頁(yè)自行理解吧)

大概長(zhǎng)這樣:

emailFinish.css文件


  1. /************************************************************
  2. ** 全局樣式 **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. /* ------------------------------------------------------------------------------ */
  102. .group {
  103. padding: 25px 40px 127px;
  104. overflow-y: auto;
  105. }
  106. .text_2 {
  107. color: #020202;
  108. font-size: 20px;
  109. font-family: 'PingFang SC';
  110. line-height: 28px;
  111. }
  112. .font_1 {
  113. font-size: 15px;
  114. font-family: 'PingFang SC';
  115. line-height: 21px;
  116. }
  117. .text_3 {
  118. margin-top: 42px;
  119. margin-bottom: 12px;
  120. color: #999999;
  121. }
  122. /* .section {
  123. margin-top: 12px;
  124. background-color: #888888;
  125. height: 1px;
  126. } */
  127. .button {
  128. margin-top: 324px;
  129. padding: 8px 0 11px;
  130. /* background-color: #166bf880; */
  131. background-image: url('。。。。。。。。。。。。。。。');
  132. background-size: 100% 100%;
  133. background-repeat: no-repeat;
  134. border-radius: 5px;
  135. }
  136. .text_4 {
  137. color: #ffffff;
  138. }
  139. /* 下一步按鈕2*/
  140. .button2 button{
  141. width: 100%;
  142. margin-top: 324px;
  143. padding: 8px 0 11px;
  144. background-color: #166bf880;
  145. border-radius: 5px;
  146. line-height: 21px;
  147. font-size: 15px;
  148. }
  149. .text_66 {
  150. color: #ffffff;
  151. }

本章也是自己參考相關(guān)資料和各位大佬的文章自行整理僅供參考,希望可以幫助到和我一樣菜雞的小伙伴

參考資料:

https://blog.csdn.net/weixin_40614372/article/details/101537653

uni-app官網(wǎng):

https://uniapp.dcloud.net.cn/component/

登錄頁(yè)面完成后我用的是Strophe.js對(duì)接Openfire的接口,然后把Strophe.js的用法加到↑本文的登錄頁(yè)里使用

藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~
希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。 

分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。 

藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 、平面設(shè)計(jì)服務(wù)UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司。

HMI車載系統(tǒng)設(shè)計(jì)趨勢(shì)

博博

3.png4.png

作者:藍(lán)藍(lán)設(shè)計(jì)   圖片來源:花瓣網(wǎng)



藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~

希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。 



分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。 



藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 平面設(shè)計(jì)服務(wù)、UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司

HMI車載系統(tǒng)設(shè)計(jì)原則

博博

1.png2.png

作者:藍(lán)藍(lán)設(shè)計(jì)   圖片來源:花瓣網(wǎng)



藍(lán)藍(lán)設(shè)計(jì)建立了UI設(shè)計(jì)分享群,每天會(huì)分享國(guó)內(nèi)外的一些優(yōu)秀設(shè)計(jì),如果有興趣的話,可以進(jìn)入一起成長(zhǎng)學(xué)習(xí),請(qǐng)加微信ban_lanlan,報(bào)下信息,藍(lán)小助會(huì)請(qǐng)您入群。歡迎您加入噢~~

希望得到建議咨詢、商務(wù)合作,也請(qǐng)與我們聯(lián)系01063334945。 



分享此文一切功德,皆悉回向給文章原作者及眾讀者. 免責(zé)聲明:藍(lán)藍(lán)設(shè)計(jì)尊重原作者,文章的版權(quán)歸原作者。如涉及版權(quán)問題,請(qǐng)及時(shí)與我們?nèi)〉寐?lián)系,我們立即更正或刪除。 



藍(lán)藍(lán)設(shè)計(jì)sillybuy.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 、平面設(shè)計(jì)服務(wù)、UI設(shè)計(jì)公司、界面設(shè)計(jì)公司、UI設(shè)計(jì)服務(wù)公司、數(shù)據(jù)可視化設(shè)計(jì)公司、UI交互設(shè)計(jì)公司、高端網(wǎng)站設(shè)計(jì)公司、UI咨詢、用戶體驗(yàn)公司、軟件界面設(shè)計(jì)公司。

日歷

鏈接

個(gè)人資料

存檔