国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo)

這篇具有很好參考價(jià)值的文章主要介紹了鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo)

常用組件開(kāi)發(fā)指導(dǎo)

list開(kāi)發(fā)指導(dǎo)

list是用來(lái)顯示列表的組件,包含一系列相同寬度的列表項(xiàng),適合連續(xù)、多行地呈現(xiàn)同類數(shù)據(jù)。具體用法請(qǐng)參考list API。

創(chuàng)建list組件

在pages/index目錄下的hml文件中創(chuàng)建一個(gè)list組件。

<!-- xxx.hml -->
<div class="container"> 
 <list>    
   <list-item class="listItem"></list-item>
   <list-item class="listItem"></list-item>
   <list-item class="listItem"></list-item>
   <list-item class="listItem"></list-item>
 </list>
</div>
/* xxx.css */
.container {
  width:100%;
  height:100%;
  flex-direction: column;
  align-items: center;
  background-color: #F1F3F5;
}
.listItem{
  height: 20%;
  background-color:#d2e0e0;
  margin-top: 20px;
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

說(shuō)明

  • 是的子組件,實(shí)現(xiàn)列表分組功能,不能再嵌套,可以嵌套。
  • 是的子組件,展示列表的具體項(xiàng)。
添加滾動(dòng)條

設(shè)置scrollbar屬性為on即可在屏幕右側(cè)生成滾動(dòng)條,實(shí)現(xiàn)長(zhǎng)列表或者屏幕滾動(dòng)等效果。

<!-- xxx.hml -->
<div class="container">
  <list class="listCss" scrollbar="on" >
    <list-item class="listItem"></list-item>
    <list-item class="listItem"></list-item>
    <list-item class="listItem"></list-item>
    <list-item class="listItem"></list-item>
    <list-item class="listItem"></list-item>
    <list-item class="listItem"></list-item>
 </list>
</div> 
/* xxx.css */
.container {
  flex-direction: column;
  background-color: #F1F3F5;
}
.listItem{
  height: 20%;
  background-color:#d2e0e0;
  margin-top: 20px;
}
.listCss{
  height: 100%;
  scrollbar-color: #8e8b8b;
  scrollbar-width: 50px;
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

添加側(cè)邊索引欄

設(shè)置indexer屬性為自定義索引時(shí),索引欄會(huì)顯示在列表右邊界處,indexer屬性設(shè)置為true,默認(rèn)為字母索引表。

<!-- xxx.hml -->
<div class="container">   
  <list class="listCss"  indexer="{
  {['#','1','2','3','4','5','6','7','8']}}" >  
    <list-item class="listItem"  section="#" ></list-item>   
  </list>
</div>
/* xxx.css */
.container{
  flex-direction: column;
  background-color: #F1F3F5;
 } 
.listCss{
  height: 100%;    
  flex-direction: column;
  columns: 1
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

說(shuō)明

  • indexer屬性生效需要flex-direction屬性配合設(shè)置為column,且columns屬性設(shè)置為1。
  • indexer可以自定義索引表,自定義時(shí)"#"必須要存在。
實(shí)現(xiàn)列表折疊和展開(kāi)

為list組件添加groupcollapse和groupexpand事件實(shí)現(xiàn)列表的折疊和展開(kāi)。

<!-- xxx.hml -->
<div class="doc-page">
  <list style="width: 100%;" id="mylist">
    <list-item-group for="listgroup in list" id="{
  {listgroup.value}}" ongroupcollapse="collapse" ongroupexpand="expand">
      <list-item type="item" style="background-color:#FFF0F5;height:95px;">
        <div class="item-group-child">
          <text>One---{
  {listgroup.value}}</text>
        </div>
      </list-item>
      <list-item type="item" style="background-color: #87CEFA;height:145px;" primary="true">
        <div class="item-group-child">
          <text>Primary---{
  {listgroup.value}}</text>
        </div>
      </list-item>
    </list-item-group>
  </list>
</div>
/* xxx.css */
.doc-page {
  flex-direction: column;
  background-color: #F1F3F5;
}
list-item{
margin-top:30px;
}
.top-list-item {
  width:100%;
  background-color:#D4F2E7;
}
.item-group-child {
  justify-content: center;
  align-items: center;
  width:100%;
}
// xxx.js
import promptAction from '@ohos.promptAction';
export default {
  data: {
    direction: 'column',
    list: []
  },
  onInit() {
    this.list = []
    this.listAdd = []
    for (var i = 1; i <= 2; i++) {
      var dataItem = {
        value: 'GROUP' + i,
      };
        this.list.push(dataItem);
    }
  },
  collapse(e) {
    promptAction.showToast({
      message: 'Close ' + e.groupid
    })
  },
  expand(e) {
    promptAction.showToast({
    message: 'Open ' + e.groupid
    })
  }
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

說(shuō)明

  • groupcollapse和groupexpand事件僅支持list-item-group組件使用。
場(chǎng)景示例

在本場(chǎng)景中,開(kāi)發(fā)者可以根據(jù)字母索引表查找對(duì)應(yīng)聯(lián)系人。

<!-- xxx.hml -->
<div class="doc-page"> 
  <text style="font-size: 35px; font-weight: 500; text-align: center; margin-top: 20px; margin-bottom: 20px;"> 
      <span>Contacts</span> 
  </text> 
  <list class="list" indexer="true"> 
    <list-item class="item" for="{
  {namelist}}" type="{
  {$item.section}}" section="{
  {$item.section}}"> 
      <div class="container"> 
        <div class="in-container"> 
          <text class="name">{
  {$item.name}}</text> 
          <text class="number">18888888888</text> 
        </div> 
      </div> 
    </list-item> 
    <list-item type="end" class="item"> 
      <div style="align-items:center;justify-content:center;width:750px;"> 
        <text style="text-align: center;">Total: 10</text> 
      </div> 
    </list-item> 
  </list> 
</div>
/* xxx.css */
.doc-page {
  width: 100%;
  height: 100%;
  flex-direction: column;
  background-color: #F1F3F5;
}
.list {
  width: 100%;
  height: 90%;
  flex-grow: 1;
}
.item {
  height: 120px;
  padding-left: 10%;
  border-top: 1px solid #dcdcdc;
}
.name {
  color: #000000;
  font-size: 39px;
}
.number {
  color: black;
  font-size: 25px;
}
.container {
  flex-direction: row;
  align-items: center;
}
.in-container {
  flex-direction: column;
  justify-content: space-around;
}
// xxx.js
export default { 
   data: { 
     namelist:[{ 
       name: 'Zoey', 
       section:'Z' 
     },{ 
       name: 'Quin', 
       section:'Q' 
     },{ 
       name:'Sam', 
       section:'S' 
     },{ 
       name:'Leo', 
       section:'L' 
     },{ 
       name:'Zach', 
       section:'Z' 
     },{ 
       name:'Wade', 
       section:'W' 
     },{ 
       name:'Zoe', 
       section:'Z' 
     },{ 
        name:'Warren', 
        section:'W' 
     },{ 
        name:'Kyle', 
        section:'K' 
     },{ 
       name:'Zaneta', 
       section:'Z' 
     }] 
   }, 
   onInit() { 
   } 
 }

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

dialog開(kāi)發(fā)指導(dǎo)

dialog組件用于創(chuàng)建自定義彈窗,通常用來(lái)展示用戶當(dāng)前需要或用戶必須關(guān)注的信息或操作。具體用法請(qǐng)參考dialog API。

創(chuàng)建dialog組件

在pages/index目錄下的hml文件中創(chuàng)建一個(gè)dialog組件,并添加Button組件來(lái)觸發(fā)dialog。dialog組件僅支持width、height、margin、margin-[left|top|right|bottom]、margin-[start|end]樣式。

<!-- xxx.hml -->
<div class="doc-page">
  <dialog class="dialogClass" id="dialogId" dragable="true">
    <div class="content">
      <text>this is a dialog</text>
    </div>
  </dialog>
  <button value="click me" onclick="opendialog"></button>
</div>
/* xxx.css */
.doc-page {
  width:100%;
  height:100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #F1F3F5;
}
.dialogClass{
  width: 80%;
  height: 250px;
  margin-start: 1%;
}
.content{
  width: 100%;
  height: 250px;
  justify-content: center;
  background-color: #e8ebec;
  border-radius: 20px;
}
text{
  width: 100%;
  height: 100%;
  text-align: center;
}
button{
  width: 70%;
  height: 60px;
}
// xxx.js
export default {
  //Touch to open the dialog box.
  opendialog(){
    this.$element('dialogId').show()
  },
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

設(shè)置彈窗響應(yīng)

開(kāi)發(fā)者點(diǎn)擊頁(yè)面上非dialog的區(qū)域時(shí),將觸發(fā)cancel事件而關(guān)閉彈窗。同時(shí)也可以通過(guò)對(duì)dialog添加show和close方法來(lái)顯示和關(guān)閉彈窗。

<!-- xxx.hml -->
<div class="doc-page">
  <dialog class="dialogClass" id="dialogId" oncancel="canceldialog">
    <div class="dialogDiv">
      <text>dialog</text>
      <button value="confirm" onclick="confirmClick"></button>
    </div>
  </dialog>
  <button value="click me" onclick="opendialog"></button>
</div>
/* xxx.css */
.doc-page {
  width:100%;
  height:100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #F1F3F5;
}
.dialogClass{
  width: 80%;
  height: 300px;
  margin-start: 1%;
}
.dialogDiv{
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-self: center;
}
text{
  height: 100px;
  align-self: center;
}
button{
  align-self: center;
  margin-top: 20px;
  width: 60%;
  height: 80px;
}
// xxx.js
import promptAction from '@ohos.promptAction';
export default {
  canceldialog(e){
    promptAction.showToast({
      message: 'dialogCancel'
    })
  },
  opendialog(){
    this.$element('dialogId').show()
     promptAction.showToast({
      message: 'dialogShow'
    })
  },
  confirmClick(e) {
    this.$element('dialogId').close()
    promptAction.showToast({
      message: 'dialogClose'
    })
  },
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

說(shuō)明

  • 僅支持單個(gè)子組件。
  • dialog屬性、樣式均不支持動(dòng)態(tài)更新。
  • dialog組件不支持focusable、click-effect屬性。
場(chǎng)景示例

在本場(chǎng)景中,開(kāi)發(fā)者可以通過(guò)dialog組件實(shí)現(xiàn)一個(gè)日程表。彈窗在打開(kāi)狀態(tài)下,利用Textarea組件輸入當(dāng)前日程,點(diǎn)擊確認(rèn)按鈕后獲取當(dāng)前時(shí)間并保存輸入文本。最后以列表形式將各日程進(jìn)行展示。

<!-- xxx.hml -->
<div class="doc-page">
  <text style="margin-top: 60px;margin-left: 30px;">
    <span>{
  {date}} events</span>
  </text>
  <div class="btndiv">
    <button type="circle" class="btn" onclick="addschedule">+</button>
  </div>
<!--  for Render events data  -->
  <list style="width: 100%;">
    <list-item type="item" for="schedulelist" style="width:100%;height: 200px;">
      <div class="schedulediv">
        <text class="text1">{
  {date}}  event</text>
        <text class="text2">{
  {$item.schedule}}</text>
      </div>
    </list-item>
  </list>
  <dialog id="datedialog" oncancel="canceldialog" >
    <div class="dialogdiv">
      <div class="innertxt">
        <text class="text3">{
  {date}}</text>
        <text class="text4">New event</text>
      </div>
      <textarea placeholder="Event information" onchange="getschedule" class="area" extend="true"></textarea>
      <div class="innerbtn">
        <button type="text" value="Cancel" onclick="cancelschedule" class="btntxt"></button>
        <button type="text" value="OK" onclick="setschedule" class="btntxt"></button>
      </div>
    </div>
  </dialog>
</div>
/* xxx.css */
.doc-page {
  flex-direction: column;
  background-color: #F1F3F5;
}
.btndiv {
  width: 100%;
  height: 200px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.btn {
  radius:60px;
  font-size: 100px;
  background-color: #1E90FF;
}
.schedulediv {
  width: 100%;
  height: 200px;
  flex-direction: column;
  justify-content: space-around;
  padding-left: 55px;
}
.text1 {
  color: #000000;
  font-weight: bold;
  font-size: 39px;
}
.text2 {
  color: #a9a9a9;
  font-size: 30px;
}
.dialogdiv {
  flex-direction: column;
  align-items: center;
}
.innertxt {
  width: 320px;
  height: 160px;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}
.text3 {
  font-family: serif;
  color: #1E90FF;
  font-size: 38px;
}
.text4 {
  color: #a9a9a9;
  font-size: 33px;
}
.area {
  width: 320px;
  border-bottom: 1px solid #1E90FF;
}
.innerbtn {
  width: 320px;
  height: 120px;
  justify-content: space-around;
}
.btntxt {
  text-color: #1E90FF;
}
// xxx.js
var info = null;
import promptAction from '@ohos.promptAction';

export default {
  data: {
    curYear:'',
    curMonth:'',
    curDay:'',
    date:'',
    schedule:'',
    schedulelist:[]
  },
  onInit() {
    // Obtain the current date. 
    var date = new Date();
    this.curYear = date.getFullYear();
    this.curMonth = date.getMonth() + 1;
    this.curDay = date.getDate();
    this.date = this.curYear + '-' + this.curMonth + '-' + this.curDay;
    this.schedulelist = []
  },
  addschedule(e) {
    this.$element('datedialog').show()
  },
  canceldialog(e) {
    promptAction.showToast({
      message: 'Event setting canceled.'
    })
  },
  getschedule(e) {
    info = e.value
  },
  cancelschedule(e) {
    this.$element('datedialog').close()
    promptAction.showToast({
      message: 'Event setting canceled.'
    })
  },
//    Touch OK to save the data.
  setschedule(e) {
    if (e.text === '') {
      this.schedule = info
    } else {
      this.schedule = info
      var addItem =  {schedule: this.schedule,}
      this.schedulelist.push(addItem)
    }
    this.$element('datedialog').close()
  }
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

form開(kāi)發(fā)指導(dǎo)

form是一個(gè)表單容器,支持容器內(nèi)Input組件內(nèi)容的提交和重置。具體用法請(qǐng)參考form API。

說(shuō)明

從 API Version 6 開(kāi)始支持。

創(chuàng)建form組件

在pages/index目錄下的hml文件中創(chuàng)建一個(gè)form組件。

<!-- xxx.hml -->
<div class="container">
  <form style="width: 100%; height: 20%">  
    <input type="text" style="width:80%"></input>
  </form>
</div>
/* xxx.css */
.container {
  width:100%;
  height:100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #F1F3F5;
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

實(shí)現(xiàn)表單縮放

為form組件添加click-effect屬性,實(shí)現(xiàn)點(diǎn)擊表單后的縮放效果,click-effect枚舉值請(qǐng)參考通用屬性。

<!-- xxx.hml -->
<div class="container">
  <form  id="formId" class="formClass" click-effect="spring-large">
    <input type="text"></input>  
  </form>
</div>
設(shè)置form樣式

通過(guò)為form添加background-color和border屬性,來(lái)設(shè)置表單的背景顏色和邊框。

/* xxx.css */
.container {
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #F1F3F5;
}
.formClass{
  width: 80%;
  height: 100px;
  padding: 10px;
  border: 1px solid #cccccc;
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

添加響應(yīng)事件

為form組件添加submit和reset事件,來(lái)提交表單內(nèi)容或重置表單選項(xiàng)。

<!-- xxx.hml -->
<div class="container">
  <form onsubmit='onSubmit' onreset='onReset' class="form">
    <div style="width: 100%;justify-content: center;">
      <label>Option 1</label>
      <input type='radio' name='radioGroup' value='radio1'></input>
      <label>Option 2</label>
      <input type='radio' name='radioGroup' value='radio2'></input>
    </div>
    <div style="width: 100%;justify-content: center; margin-top: 20px">
      <input type="submit" value="Submit" style="width:120px; margin-right:20px;" >   
      </input>
      <input type="reset" value="Reset" style="width:120px;"></input>
    </div>
  </form>
</div>
/* index.css */
.container{
  width: 100%;
  height: 100%;
  flex-direction: column;
  justify-items: center;
  align-items: center;
  background-color: #F1F3F5;
}
.form{
  width: 100%;
  height: 30%;
  margin-top: 40%;
  flex-direction: column;
  justify-items: center;
  align-items: center;
}
// xxx.js
import promptAction from '@ohos.promptAction';
export default{
  onSubmit(result) {
    promptAction.showToast({
      message: result.value.radioGroup
    })
  },
  onReset() {
    promptAction.showToast({
      message: 'Reset All'
    })
  }
}

鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo),鴻蒙HarmonyOS社區(qū),前端,harmonyos,javascript

場(chǎng)景示例

在本場(chǎng)景中,開(kāi)發(fā)者可以選擇相應(yīng)選項(xiàng)并提交或重置數(shù)據(jù)。

創(chuàng)建Input組件,分別設(shè)置type屬性為checkbox(多選框)和radio(單選框),再使用form組件的onsubmit和onreset事件實(shí)現(xiàn)表單數(shù)據(jù)的提交與重置。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-785026.html

<!-- xxx.hml -->
<div class="container">
   <form onsubmit="formSubmit" onreset="formReset">
 <text style="font-size: 30px; margin-bottom: 20px; margin-top: 100px;">
      <span > Form </span>
  </text>
    <div style="flex-direction: column;width: 90%;padding: 30px 0px;">
     <text class="txt">Select 1 or more options</text>
      <div style="width: 90%;height: 150px;align-items: center;justify-content: space-around;">
        <label target="checkbox1">Option 1</label>
        <input id="checkbox1" type="checkbox" name="checkbox1"></input>
        <label target="checkbox2">Option 2</label>
        <input id="checkbox2" type="checkbox" name="checkbox2"></input>
       </div>
       <divider style="margin: 20px 0px;color: pink;height: 5px;"></divider>
       <text class="txt">Select 1 option</text>
       <div style="width: 90%;height: 150px;align-items: center;justify-content: space-around;">
         <label target="radio1">Option 1</label>
         <input id="radio1" type="radio" name="myradio"></input>
         <label target="radio2">Option 2</label>
         <input id="radio2" type="radio" name="myradio"></input>
       </div>
       <divider style="margin: 20px 0px;color: pink;height: 5px;"></divider>
       <text class="txt">Text box</text>
       <input type="text" placeholder="Enter content." style="margin-top: 50px;"></input>
       <div style="width: 90%;align-items: center;justify-content: space-between;margin: 40px;">
         <input type="submit">Submit</input>
         <input type="reset">Reset</input>
       </div>
    </div>
  </form>

到了這里,關(guān)于鴻蒙HarmonyOS兼容JS的類Web開(kāi)發(fā)-開(kāi)發(fā)指導(dǎo)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • HarmonyOS鴻蒙基于Java開(kāi)發(fā): 基于JS UI實(shí)現(xiàn)的Java卡片開(kāi)發(fā)

    使用hml+css+json開(kāi)發(fā)JS卡片頁(yè)面。 創(chuàng)建成功后,在config.json的module中會(huì)生成js模塊,用于對(duì)應(yīng)卡片的js相關(guān)資源,配置示例如下: config.json文件“abilities”配置forms模塊細(xì)節(jié)如下。 說(shuō)明 配置文件中,應(yīng)注意如下配置: 表1? forms對(duì)象的內(nèi)部結(jié)構(gòu)說(shuō)明 屬性名稱 子屬性名稱 含義

    2024年02月20日
    瀏覽(26)
  • 詳細(xì)教程 - 從零開(kāi)發(fā) Vue 鴻蒙harmonyOS應(yīng)用 第三節(jié) (封裝TabBar JS版)

    本組件通過(guò)HML布局、CSS樣式和JS邏輯封裝實(shí)現(xiàn)一個(gè)通用的Tabbar。支持可配置的Tab項(xiàng)和對(duì)應(yīng)頁(yè)面,可以方便接入到不同頁(yè)面中,提高開(kāi)發(fā)效率。 HML部分采用Flex布局實(shí)現(xiàn)Tabbar的整體結(jié)構(gòu),包含多個(gè)Tab項(xiàng)。 CSS部分定義樣式,包括圖標(biāo)大小、文字顏色等樣式參數(shù)。支持后續(xù)擴(kuò)展。 JS部分提

    2024年02月04日
    瀏覽(24)
  • 【鴻蒙(HarmonyOS)】UI開(kāi)發(fā)的兩種范式:ArkTS、JS(以登錄界面開(kāi)發(fā)為例進(jìn)行對(duì)比)

    【鴻蒙(HarmonyOS)】UI開(kāi)發(fā)的兩種范式:ArkTS、JS(以登錄界面開(kāi)發(fā)為例進(jìn)行對(duì)比)

    之后關(guān)于HarmonyOS技術(shù)的分享,將會(huì)持續(xù)使用到以下版本 HarmonyOS:3.1/4.0 SDK:API 9 Release Node.js:v14.20.1 DevEco Studio: 3.1.0 HarmonyOS應(yīng)用的UI開(kāi)發(fā)依賴于 方舟開(kāi)發(fā)框架(簡(jiǎn)稱ArkUI) 。 根據(jù)官方介紹,ArkUI提供了UI語(yǔ)法、豐富的UI功能(組件、布局、動(dòng)畫以及交互事件),以及實(shí)時(shí)界面

    2024年02月08日
    瀏覽(17)
  • HarmonyOS鴻蒙基于Java開(kāi)發(fā): Java UI JS FA調(diào)用Java PA機(jī)制

    目錄 FA調(diào)用PA接口 FA調(diào)用PA常見(jiàn)問(wèn)題 示例參考 使用兼容JS的類Web開(kāi)發(fā)范式的方舟開(kāi)發(fā)框架提供了JS FA(Feature Ability)調(diào)用Java PA(Particle Ability)的機(jī)制,該機(jī)制提供了一種通道來(lái)傳遞方法調(diào)用、處理數(shù)據(jù)返回以及訂閱事件上報(bào),支持的UI頁(yè)面和組件請(qǐng)參考構(gòu)建JS用戶界面 。 當(dāng)前

    2024年01月19日
    瀏覽(22)
  • 純鴻蒙!華為HarmonyOS NEXT不再兼容安卓應(yīng)用,無(wú)法安裝Apk文件

    純鴻蒙!華為HarmonyOS NEXT不再兼容安卓應(yīng)用,無(wú)法安裝Apk文件

    ??????? 8月7日消息,近日,華為舉行2023年華為開(kāi)發(fā)者大會(huì)(HDC.Together)上,除了發(fā)布HarmonyOS 4、全新升級(jí)的鴻蒙開(kāi)發(fā)套件外,華為還帶來(lái)了HarmonyOS NEXT開(kāi)發(fā)者預(yù)覽版。 據(jù)了解,HarmonyOS NEXT開(kāi)發(fā)者預(yù)覽版8月面向合作企業(yè)開(kāi)發(fā)者開(kāi)放,2024年第一季度面向所有開(kāi)發(fā)者開(kāi)放。 ?

    2024年02月09日
    瀏覽(25)
  • HarmonyOS:NativeWindow 開(kāi)發(fā)指導(dǎo)

    HarmonyOS:NativeWindow 開(kāi)發(fā)指導(dǎo)

    NativeWindow 是 HarmonyOS 本地平臺(tái)化窗口 ,表示圖形隊(duì)列的生產(chǎn)者端。開(kāi)發(fā)者可以通過(guò) NativeWindow 接口進(jìn)行申請(qǐng)和提交 Buffer,配置 Buffer 屬性信息。 針對(duì) NativeWindow,常見(jiàn)的開(kāi)發(fā)場(chǎng)景如下: ●?通過(guò) NativeWindow 提供的 Native?API 接口申請(qǐng)圖形 Buffer,并將生產(chǎn)圖形內(nèi)容寫入圖形 Buffe

    2024年02月04日
    瀏覽(18)
  • HarmonyOS 音頻通話開(kāi)發(fā)指導(dǎo)

    常用的音頻通話模式包括 VOIP 通話和蜂窩通話。 ●?VOIP 通話:VOIP(Voice?over?Internet?Protocol)通話是指基于互聯(lián)網(wǎng)協(xié)議(IP)進(jìn)行通訊的一種語(yǔ)音通話技術(shù)。VOIP 通話會(huì)將通話信息打包成數(shù)據(jù)包,通過(guò)網(wǎng)絡(luò)進(jìn)行傳輸,因此 VOIP 通話對(duì)網(wǎng)絡(luò)要求較高,通話質(zhì)量與網(wǎng)絡(luò)連接速度緊

    2024年02月08日
    瀏覽(21)
  • HarmonyOS音頻開(kāi)發(fā)指導(dǎo):使用AVPlayer開(kāi)發(fā)音頻播放功能

    HarmonyOS音頻開(kāi)發(fā)指導(dǎo):使用AVPlayer開(kāi)發(fā)音頻播放功能

    在HarmonyOS系統(tǒng)中,多種API都提供了音頻播放開(kāi)發(fā)的支持,不同的API適用于不同音頻數(shù)據(jù)格式、音頻資源來(lái)源、音頻使用場(chǎng)景,甚至是不同開(kāi)發(fā)語(yǔ)言。因此,選擇合適的音頻播放API,有助于降低開(kāi)發(fā)工作量,實(shí)現(xiàn)更佳的音頻播放效果。 ●?AVPlayer:功能較完善的音頻、視頻播放

    2024年01月20日
    瀏覽(22)
  • 開(kāi)發(fā)指導(dǎo)—利用組件&插值器動(dòng)畫實(shí)現(xiàn) HarmonyOS 動(dòng)效

    開(kāi)發(fā)指導(dǎo)—利用組件&插值器動(dòng)畫實(shí)現(xiàn) HarmonyOS 動(dòng)效

    在組件上創(chuàng)建和運(yùn)行動(dòng)畫的快捷方式。具體用法請(qǐng)參考通用方法。 通過(guò)調(diào)用 animate 方法獲得 animation 對(duì)象,animation 對(duì)象支持動(dòng)畫屬性、動(dòng)畫方法和動(dòng)畫事件。 說(shuō)明 ●?使用 animate 方法時(shí)必須傳入 Keyframes 和 Options 參數(shù)。 ●?多次調(diào)用 animate 方法時(shí),采用 replace 策略,即最后一

    2024年02月09日
    瀏覽(22)
  • 開(kāi)發(fā)指導(dǎo)—利用CSS動(dòng)畫實(shí)現(xiàn)HarmonyOS動(dòng)效(一)

    開(kāi)發(fā)指導(dǎo)—利用CSS動(dòng)畫實(shí)現(xiàn)HarmonyOS動(dòng)效(一)

    注:本文內(nèi)容分享轉(zhuǎn)載自 HarmonyOS?Developer 官網(wǎng)文檔 CSS 是描述 HML 頁(yè)面結(jié)構(gòu)的樣式語(yǔ)言。所有組件均存在系統(tǒng)默認(rèn)樣式,也可在頁(yè)面 CSS 樣式文件中對(duì)組件、頁(yè)面自定義不同的樣式。請(qǐng)參考通用樣式了解兼容 JS 的類 Web 開(kāi)發(fā)范式支持的組件樣式。 ●?邏輯像素 px(文檔中以le

    2024年02月10日
    瀏覽(23)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包