自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

鴻蒙提示框,對(duì)話框,路由跳轉(zhuǎn)頁(yè)面,跑馬燈,幻燈片及l(fā)ist組件的應(yīng)用

開(kāi)發(fā)
文章由鴻蒙社區(qū)產(chǎn)出,想要了解更多內(nèi)容請(qǐng)前往:51CTO和華為官方戰(zhàn)略合作共建的鴻蒙技術(shù)社區(qū)https://harmonyos.51cto.com/#zz

[[379043]]

 想了解更多內(nèi)容,請(qǐng)?jiān)L問(wèn):

51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)

https://harmonyos.51cto.com/#zz

幻燈片控件:<image-animator></image-animator>

跑馬燈控件: <marquee></marquee>

彈出提示框:prompt.showToast()

彈出對(duì)話框:prompt.showDialog()

在制作提示框的時(shí)候,首先制作一個(gè)菜單欄選項(xiàng),彈出菜單欄僅有當(dāng)調(diào)試點(diǎn)擊后才觸發(fā)顯示出來(lái) 不占用原有視圖空間.彈出菜單欄的位置默認(rèn)以(0,0)為基準(zhǔn)點(diǎn),為了更好的用戶體驗(yàn),也可以自行設(shè)置彈出位置(如下圖)


介紹一種跳轉(zhuǎn)頁(yè)面新方法:路由跳轉(zhuǎn)頁(yè)面(具體見(jiàn)代碼): import router from '@system.router'; //通過(guò)路由跳轉(zhuǎn)頁(yè)面

router.push({ uri: 'pages/jumpone/jumpone'}) //路由的方法

主頁(yè)面的js業(yè)務(wù)邏輯層:

  1. import prompt from '@system.prompt'
  2. import router from '@system.router';  //路由  通過(guò)路由跳轉(zhuǎn)頁(yè)面 
  3. export default { 
  4.     data: { 
  5.         title: 'World'
  6.         imgdatas:[{ 
  7.                       "src":"http://ttjib3.natappfree.cc/images/12.jpeg" 
  8.                   }, 
  9.                   { 
  10.                       "src":"http://ttjib3.natappfree.cc/images/13.jpg" 
  11.                   }, 
  12.                   { 
  13.                      "src":"http://ttjib3.natappfree.cc/images/14.jpg" 
  14.                   }, 
  15.                    { 
  16.                       "src":"http://ttjib3.natappfree.cc/images/15.jpg" 
  17.                   }, 
  18.                   { 
  19.                    "src":"http://ttjib3.natappfree.cc/images/16.png" 
  20.                }] 
  21.     }, 
  22.         showmenu() { 
  23.             //彈出顯示菜單    首先要獲取這個(gè)組件用  this.$element 
  24.  
  25.             //this.$element("menueone").show(); 
  26.  
  27.             //彈出的具體位置 默認(rèn)時(shí)以(0,0)為基準(zhǔn)點(diǎn) 
  28.              this.$element("menueone").show({ 
  29.                x:0, 
  30.                  y:0 
  31.            }); 
  32.         }, 
  33.         changemenu(e) { 
  34.             let name = e.value //這里的value就是hml中的value 
  35.             //鴻蒙的提示框 
  36.             prompt.showToast({ 
  37.                 message:name 
  38.             }); 
  39.             if (name == "太和殿"
  40.             { 
  41.                 router.push({                   //路由的方法 
  42.                     uri: 'pages/jumpone/jumpone' 
  43.                 }); 
  44.             } 
  45.             else if(name == "養(yǎng)心殿"
  46.             { 
  47.                 router.push({                    //路由的方法 
  48.                     uri: 'pages/jumptwo/jumptwo' 
  49.                 }); 
  50.             } 
  51.             else if(name == "乾清宮"
  52.             { 
  53.                 router.push({                     //路由的方法 
  54.                     uri: 'pages/jumpthree/jumpthree' 
  55.                 }); 
  56.             } 
  57.         } 
  58.  

 主頁(yè)面視圖層:

  1. <div class="container"
  2.    <div class="topview"
  3.        <!--幻燈片組件--> 
  4.        <image-animator class="image-animator" duration="5s" fixedsize="false" images="{{imgdatas}}"
  5.        </image-animator> 
  6.    </div> 
  7.     <div class="contentview"
  8.         <button onclick="showmenu">菜單</button> 
  9.     </div> 
  10.     <menu id="menueone" onselected="changemenu"
  11.         <option value="太和殿">太和殿</option
  12.         <option value="養(yǎng)心殿">養(yǎng)心殿</option
  13.         <option value="乾清宮">乾清宮</option
  14.     </menu> 
  15. </div> 

主頁(yè)面css屬性設(shè)置:

  1. .container { 
  2.  
  3.     width:100%; 
  4.     height: 1200px; 
  5.     display: flex; 
  6.     flex-direction: column
  7.     background-color: skyblue; 
  8. .topview{ 
  9.     width: 100%; 
  10.     height: 30%; 
  11.     border-bottom: 1px solid blue; 
  12. .image-animator{ 
  13.     width: 100%; 
  14.     height: 100%; 
  15. .contentview{ 
  16.     width: 100%; 
  17.     height: 10%; 
  18.     background-color: white; 

跳轉(zhuǎn)頁(yè)面一的js業(yè)務(wù)邏輯層:

  1. import prompt from '@system.prompt'
  2.  
  3. export default { 
  4.     data: { 
  5.         title: 'World' 
  6.     }, 
  7.     changmes() { 
  8.         //1.彈出提示框 
  9.         // prompt.showToast() 
  10.         //2.彈出對(duì)話框 
  11.         prompt.showDialog({ 
  12.             title:"問(wèn)題"
  13.             message:"你今年是否有600歲?"
  14.             buttons:[{"text":"是","color":"#000000"},{"text":"否","color":"#000000"}], 
  15.             //用successs追蹤對(duì)話框 
  16.             success:function(data){ 
  17.                    if(data.index==0){ 
  18.                        prompt.showToast({ 
  19.                            message:"你點(diǎn)擊了是按鈕" 
  20.                        }) 
  21.                    } 
  22.                    if(data.index==1){ 
  23.                        prompt.showToast({ 
  24.                            message:"你點(diǎn)擊了否按鈕" 
  25.                        }) 
  26.                    } 
  27.             } 
  28.         }) 
  29.     } 

 跳轉(zhuǎn)頁(yè)面一的視圖層:

  1. <div class="container"
  2.        <button onclick="changmes">太和殿</button> 
  3. </div> 

跳轉(zhuǎn)頁(yè)面二的視圖層:

  1. <div class="container"
  2.   <marquee> 
  3.       最是一年春好處,絕勝煙柳滿皇都 
  4.   </marquee> 
  5. </div> 

跳轉(zhuǎn)頁(yè)面三的js業(yè)務(wù)邏輯層:

  1. import router from '@system.router'
  2. export default { 
  3.     data: { 
  4.         title: 'World'
  5.         listdatas:[{"cname":"故宮典藏","cimg":"/common/gugong.png","lname":[{"fname":"宮廷人物","icon":"/common/renwu.png"},{"fname":"宮廷典制","icon":"/common/gugong.png"},{"fname":"宮廷文創(chuàng)","icon":"/common/gongwenhua.png"},{"fname":"宮廷建筑","icon":"/common/gu.png"}]}, 
  6.                    {"cname":"故宮文創(chuàng)","cimg":"/common/gugong.png","lname":[]}, 
  7.                    {"cname":"故宮建筑","cimg":"/common/gugong.png","lname":[]}, 
  8.                    {"cname":"故宮歷史","cimg":"/common/gugong.png","lname":[]} 
  9.         ] 
  10.     }, 
  11.     changemenu(e){ 
  12.          router.push({ 
  13.              uri:'pages/gugongwenchuang/gugongwenchuang' 
  14.          }) 
  15.     } 

 跳轉(zhuǎn)頁(yè)面三的視圖層:

  1. <div class="container"
  2.     <list class="listview"
  3.         <block for="{{listdatas}}"
  4.             <list-item-group class="group">      <!--高度不需要給出 會(huì)自適應(yīng)大小--> 
  5.                 <list-item class="listitem"
  6.                     <image class="img1" src="{{$item.cimg}}"></image> 
  7.                     <text class="txt1">{{$item.cname}}</text> 
  8.                 </list-item> 
  9.                 <block for="{{(cindx,cvalue) in $item.lname}}"
  10.                     <list-item class="listitem1" onclick="changemenu"
  11.                         <image class="img1" src="{{cvalue.icon}}"></image> 
  12.                         <text class="txt2">{{cvalue.fname}}</text> 
  13.                     </list-item> 
  14.                 </block> 
  15.             </list-item-group
  16.         </block> 
  17.     </list> 
  18. </div> 

跳轉(zhuǎn)頁(yè)面三的css屬性設(shè)置:

  1. .container { 
  2.     width: 100%; 
  3.     height: 1200px; 
  4.     display: flex; 
  5.     flex-direction: column
  6.     background-color: skyblue; 
  7. .listview{ 
  8.     width: 100%; 
  9.     height: 100%; 
  10. .group
  11.     width: 100%; 
  12. .listitem{ 
  13.     width: 100%; 
  14.     height: 25%; 
  15.     display: flex; 
  16.     justify-content:center; 
  17.     align-items: center; 
  18. .img1{ 
  19.     width: 80px; 
  20.     height: 80px; 
  21. .txt1{ 
  22.     font-size: 45px; 
  23.     font-weight: bold; 
  24.     font-family: sans-serif; 
  25.     margin-left: 70px; 
  26. .txt2{ 
  27.     font-size: 35px; 
  28.  
  29.     font-family: sans-serif; 
  30.     margin-left: 70px; 
  31. .listitem1{ 
  32.     width: 100%; 
  33.     height: 18%; 
  34.     display: flex; 
  35.     justify-content:center; 
  36.     align-items: center; 

 效果圖如下,效果視頻已上傳專欄(HarmonyOS開(kāi)發(fā)從0到1) https://harmonyos.51cto.com/column/35

 


 


©著作權(quán)歸作者和HarmonyOS技術(shù)社區(qū)共同所有,如需轉(zhuǎn)載,請(qǐng)注明出處,否則將追究法律責(zé)任。

想了解更多內(nèi)容,請(qǐng)?jiān)L問(wèn):

51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)

https://harmonyos.51cto.com/#zz

 

責(zé)任編輯:jianghua 來(lái)源: 鴻蒙社區(qū)
相關(guān)推薦

2021-01-28 14:34:35

鴻蒙HarmonyOS應(yīng)用開(kāi)發(fā)

2011-07-21 15:50:42

jQuery Mobi頁(yè)面對(duì)話框

2015-08-07 15:45:02

swift跑馬燈源碼

2022-03-02 15:47:57

Dialog組件UI設(shè)計(jì)鴻蒙

2011-07-01 11:33:00

Qt 模態(tài) 非模態(tài)

2009-02-09 17:45:12

Impressive播放幻燈片 SourceForg

2011-07-29 10:01:21

IOS 跑馬燈

2011-10-10 14:05:08

jQuery插件

2010-01-13 18:22:55

VB.NET對(duì)話框

2014-12-31 15:42:21

Android多線程軟件下載

2020-10-15 06:00:22

LinuxLinux終端幻燈片

2013-06-25 11:21:35

Android開(kāi)發(fā)幻燈片效果Gallery

2011-07-22 15:32:53

iPhone 按鈕 對(duì)話框

2010-01-28 16:55:26

Android對(duì)話框

2022-07-12 08:32:17

transition跑馬燈

2009-12-28 13:47:35

WPF對(duì)話框

2009-12-28 14:32:31

WPF窗體對(duì)話框

2009-12-11 15:35:50

PHP彈出對(duì)話框

2011-07-13 17:09:34

WPS幻燈片

2012-12-03 10:47:54

WebJQuery控件
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)