chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

鴻蒙ArkTS容器組件:ListItem

jf_46214456 ? 來源:jf_46214456 ? 作者:jf_46214456 ? 2024-07-10 15:41 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

ListItem

用來展示列表具體item,必須配合List來使用。

說明:
開發(fā)前請熟悉鴻蒙開發(fā)指導(dǎo)文檔 :[gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md]

  • 該組件從API Version 7開始支持。后續(xù)版本如有新增內(nèi)容,則采用上角標(biāo)單獨標(biāo)記該內(nèi)容的起始版本。
  • 該組件的父組件只能是[List]或者[ListItemGroup]。

子組件

可以包含單個子組件。

接口

從API version 9開始,該接口支持在ArkTS卡片中使用。

ListItem10+

ListItem(value?: ListItemOptions)

參數(shù):

參數(shù)名參數(shù)類型必填參數(shù)描述
value[ListItemOptions]為ListItem提供可選參數(shù), 該對象內(nèi)含有ListItemStyle枚舉類型的style參數(shù)。

屬性

除支持[通用屬性]外,還支持以下屬性:

名稱參數(shù)類型描述
selectable8+boolean當(dāng)前ListItem元素是否可以被鼠標(biāo)框選。**說明:**外層List容器的鼠標(biāo)框選開啟時,ListItem的框選才生效。 默認(rèn)值:true
selected10+boolean設(shè)置當(dāng)前ListItem選中狀態(tài)。該屬性支持[$$]雙向綁定變量。**說明:**該屬性需要在設(shè)置[選中態(tài)樣式]前使用才能生效選中態(tài)樣式。 默認(rèn)值:false
swipeAction9+{ start?: CustomBuilder[SwipeActionItem], end?:CustomBuilder

SwipeEdgeEffect9+枚舉說明

名稱描述
SpringListItem劃動距離超過劃出組件大小后可以繼續(xù)劃動。如果設(shè)置了刪除區(qū)域,ListItem劃動距離超過刪除閾值后可以繼續(xù)劃動,松手后按照彈簧阻尼曲線回彈。
NoneListItem劃動距離不能超過劃出組件大小。如果設(shè)置了刪除區(qū)域,ListItem劃動距離不能超過刪除閾值,并且在設(shè)置刪除回調(diào)的情況下,達(dá)到刪除閾值后松手觸發(fā)刪除回調(diào)。

SwipeActionItem10+對象說明

List垂直布局,ListItem向右滑動,item左邊的長距離滑動刪除選項或向左滑動時,item右邊的長距離滑動刪除選項。 List水平布局,ListItem向上滑動,item下邊的長距離滑動刪除選項或向下滑動時,item上邊的長距離滑動刪除選項。

名稱參數(shù)類型必填描述
actionAreaDistance[Length]設(shè)置組件長距離滑動刪除距離閾值。 默認(rèn)值:56vp**說明:**不支持設(shè)置百分比。 刪除距離閾值大于item寬度減去劃出組件寬度,或刪除距離閾值小于等于0就不會設(shè)置刪除區(qū)域。
onAction() => void組件進(jìn)入長距刪除區(qū)后刪除ListItem時調(diào)用,進(jìn)入長距刪除區(qū)后抬手時觸發(fā)。**說明:**滑動后松手的位置超過或等于設(shè)置的距離閾值,并且設(shè)置的距離閾值有效時才會觸發(fā)。
onEnterActionArea() => void在滑動條目進(jìn)入刪除區(qū)域時調(diào)用,只觸發(fā)一次,當(dāng)再次進(jìn)入時仍觸發(fā)。
onExitActionArea() => void當(dāng)滑動條目退出刪除區(qū)域時調(diào)用,只觸發(fā)一次,當(dāng)再次退出時仍觸發(fā)。
builderCustomBuilder當(dāng)列表項向右或向右滑動(當(dāng)列表方向為“垂直”時),向下或向下滑動(當(dāng)列方向為“水平”時)時顯示的操作項。

ListItemOptions10+對象說明

名稱參數(shù)類型必填描述
style[ListItemStyle]設(shè)置List組件卡片樣式。 默認(rèn)值: ListItemStyle.NONE 設(shè)置為ListItemStyle.NONE時無樣式。 設(shè)置為ListItemStyle.CARD時,必須配合[ListItemGroup]的ListItemGroupStyle.CARD同時使用,顯示默認(rèn)卡片樣式。 卡片樣式下,ListItem默認(rèn)規(guī)格:高度48vp,寬度100%。 卡片樣式下, 為卡片內(nèi)的列表選項提供了默認(rèn)的focus、hover、press、selected和disable樣式。**說明:**當(dāng)前卡片模式下,不支持listDirection屬性設(shè)置,使用默認(rèn)Axis.Vertical排列方向。 當(dāng)前卡片模式下,List屬性alignListItem默認(rèn)為ListItemAlign.Center,居中對齊顯示。 若僅設(shè)置ListItemStyle.CARD,未設(shè)置ListItemGroupStyle.CARD時,只顯示部分卡片樣式及功能。

ListItemStyle10+枚舉說明

名稱描述
NONE無樣式。
CARD顯示默認(rèn)卡片樣式。

事件

名稱功能描述HarmonyOSOpenHarmony鴻蒙文檔籽料:mau123789是v直接拿
onSelect(event: (isSelected: boolean) => void)8+ListItem元素被鼠標(biāo)框選的狀態(tài)改變時觸發(fā)回調(diào)。 isSelected:進(jìn)入鼠標(biāo)框選范圍即被選中返回true, 移出鼠標(biāo)框選范圍即未被選中返回false。

示例

示例1

// xxx.ets
@Entry
@Component
struct ListItemExample {
  private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

  build() {
    Column() {
      List({ space: 20, initialIndex: 0 }) {
        ForEach(this.arr, (item: number) = > {
          ListItem() {
            Text('' + item)
              .width('100%')
              .height(100)
              .fontSize(16)
              .textAlign(TextAlign.Center)
              .borderRadius(10)
              .backgroundColor(0xFFFFFF)
          }
        }, (item: string) = > item)
      }.width('90%')
      .scrollBar(BarState.Off)
    }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
  }
}

zh-cn_image_0000001219864159

示例2

// xxx.ets
@Entry
@Component
struct ListItemExample2 {
  @State message: string = 'Hello World'
  @State arr: number[] = [0, 1, 2, 3, 4]
  @State enterEndDeleteAreaString: string = "not enterEndDeleteArea"
  @State exitEndDeleteAreaString: string = "not exitEndDeleteArea"

  @Builder itemEnd() {
    Row() {
      Button("Delete").margin("4vp")
      Button("Set").margin("4vp")
    }.padding("4vp").justifyContent(FlexAlign.SpaceEvenly)
  }

  build() {
    Column() {
      List({ space: 10 }) {
        ForEach(this.arr, (item: number) = > {
          ListItem() {
            Text("item" + item)
              .width('100%')
              .height(100)
              .fontSize(16)
              .textAlign(TextAlign.Center)
              .borderRadius(10)
              .backgroundColor(0xFFFFFF)
          }
          .transition({ type: TransitionType.Delete, opacity: 0 })
          .swipeAction({
            end: {
              builder: () = > { this.itemEnd() },
              onAction: () = > {
                animateTo({ duration: 1000 }, () = > {
                  let index = this.arr.indexOf(item)
                  this.arr.splice(index, 1)
                })
              },
              actionAreaDistance: 56,
              onEnterActionArea: () = > {
                this.enterEndDeleteAreaString = "enterEndDeleteArea"
                this.exitEndDeleteAreaString = "not exitEndDeleteArea"
              },
              onExitActionArea: () = > {
                this.enterEndDeleteAreaString = "not enterEndDeleteArea"
                this.exitEndDeleteAreaString = "exitEndDeleteArea"
              }
            }
          })
        }, (item: string) = > item)
      }
      Text(this.enterEndDeleteAreaString).fontSize(20)
      Text(this.exitEndDeleteAreaString).fontSize(20)
    }
    .padding(10)
    .backgroundColor(0xDCDCDC)
    .width('100%')
    .height('100%')
  }
}

deleteListItem

示例3

// xxx.ets
@Entry
@Component
struct ListItemExample3 {
  build() {
    Column() {
      List({ space: "4vp", initialIndex: 0 }) {
        ListItemGroup({ style: ListItemGroupStyle.CARD }) {
          ForEach([ListItemStyle.CARD, ListItemStyle.CARD, ListItemStyle.NONE], (itemStyle: number, index?: number) = > {
            ListItem({ style: itemStyle }) {
              Text("" + index)
                .width("100%")
                .textAlign(TextAlign.Center)
            }
          })
        }
        ForEach([ListItemStyle.CARD, ListItemStyle.CARD, ListItemStyle.NONE], (itemStyle: number, index?: number) = > {
          ListItem({ style: itemStyle }) {
            Text("" + index)
              .width("100%")
              .textAlign(TextAlign.Center)
          }
        })
      }
      .width('100%')
      .multiSelectable(true)
      .backgroundColor(0xDCDCDC) // 淺藍(lán)色的List
    }
    .width('100%')
    .padding({ top: 5 })
  }
}

ListItemStyle

審核編輯 黃宇

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • 組件
    +關(guān)注

    關(guān)注

    1

    文章

    532

    瀏覽量

    18424
  • 鴻蒙
    +關(guān)注

    關(guān)注

    60

    文章

    2620

    瀏覽量

    44058
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關(guān)推薦
    熱點推薦

    HarmonyOS/OpenHarmony原生應(yīng)用-ArkTS萬能卡片組件Badge

    可以附加在單個組件上用于信息標(biāo)記的容器組件。該組件從API Version 7開始支持。 支持單個子組件。子
    發(fā)表于 09-28 11:53

    鴻蒙ArkTS容器組件:Column

    沿垂直方向布局的容器。
    的頭像 發(fā)表于 07-05 16:32 ?926次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:Column

    鴻蒙ArkTS容器組件:Flex

    以彈性方式布局子組件容器組件。
    的頭像 發(fā)表于 07-08 10:19 ?961次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:Flex

    鴻蒙ArkTS容器組件:GridCol

    柵格子組件,必須作為柵格容器組件([GridRow])的子組件使用。
    的頭像 發(fā)表于 07-08 15:17 ?855次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:GridCol

    鴻蒙ArkTS容器組件:GridItem

    網(wǎng)格容器中單項內(nèi)容容器。
    的頭像 發(fā)表于 07-09 09:25 ?797次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:GridItem

    鴻蒙ArkTS容器組件:ListItemGroup

    組件用來展示列表item分組,寬度默認(rèn)充滿[List]組件,必須配合List組件來使用。
    的頭像 發(fā)表于 07-10 09:20 ?1339次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:ListItemGroup

    鴻蒙ArkTS容器組件:Navigator

    路由容器組件,提供路由跳轉(zhuǎn)能力。
    的頭像 發(fā)表于 07-10 14:55 ?784次閱讀

    鴻蒙ArkTS容器組件:Refresh

    可以進(jìn)行頁面下拉操作并顯示刷新動效的容器組件
    的頭像 發(fā)表于 07-11 16:11 ?916次閱讀

    鴻蒙ArkTS容器組件:RowSplit

    將子組件橫向布局,并在每個子組件之間插入一根縱向的分割線。
    的頭像 發(fā)表于 07-11 22:25 ?694次閱讀

    鴻蒙ArkTS容器組件:Scroll

    可滾動的容器組件,當(dāng)子組件的布局尺寸超過父組件的尺寸時,內(nèi)容可以滾動。
    的頭像 發(fā)表于 07-12 15:24 ?2087次閱讀

    鴻蒙ArkTS容器組件:SideBarContainer

    提供側(cè)邊欄可以顯示和隱藏的側(cè)邊欄容器,通過子組件定義側(cè)邊欄和內(nèi)容區(qū),第一個子組件表示側(cè)邊欄,第二個子組件表示內(nèi)容區(qū)。
    的頭像 發(fā)表于 07-18 15:46 ?1086次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:SideBarContainer

    鴻蒙ArkTS容器組件:Stack

    堆疊容器,子組件按照順序依次入棧,后一個子組件覆蓋前一個子組件。
    的頭像 發(fā)表于 07-15 18:23 ?1404次閱讀

    鴻蒙ArkTS容器組件:Swiper

    滑塊視圖容器,提供子組件滑動輪播顯示的能力。
    的頭像 發(fā)表于 07-15 09:51 ?1405次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:Swiper

    鴻蒙ArkTS容器組件:Tabs

    通過頁簽進(jìn)行內(nèi)容視圖切換的容器組件,每個頁簽對應(yīng)一個內(nèi)容視圖。
    的頭像 發(fā)表于 07-15 09:48 ?1738次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:Tabs

    鴻蒙ArkTS容器組件:WaterFlow

    瀑布流容器,由“行”和“列”分割的單元格所組成,通過容器自身的排列規(guī)則,將不同大小的“項目”自上而下,如瀑布般緊密布局。
    的頭像 發(fā)表于 07-15 17:35 ?813次閱讀
    <b class='flag-5'>鴻蒙</b><b class='flag-5'>ArkTS</b><b class='flag-5'>容器</b><b class='flag-5'>組件</b>:WaterFlow