当前位置: 首页 > news >正文

asp技术做网站建站服务

asp技术做网站,建站服务,家居企业网站建设效果,网络推广哪个网站好官方文档:选项卡 (Tabs) 目录标题 底部导航顶部导航侧边导航限制导航栏的滑动切换固定导航栏・可滚动导航栏自定义导航栏切换至指定页签 底部导航 Entry Component struct Bujv_tabs {build() {Column() {Tabs({ barPosition: BarPosition.End }) {TabContent() {T…

官方文档:选项卡 (Tabs)

目录标题

  • 底部导航
  • 顶部导航
  • 侧边导航
  • 限制导航栏的滑动切换
  • 固定导航栏・可滚动导航栏
  • 自定义导航栏
    • 切换至指定页签

底部导航

@Entry
@Component
struct Bujv_tabs {build() {Column() {Tabs({ barPosition: BarPosition.End }) {TabContent() {Text('首页的内容').fontSize(30)}.tabBar('首页')TabContent() {Text('推荐的内容').fontSize(30)}.tabBar('推荐')TabContent() {Text('发现的内容').fontSize(30)}.tabBar('发现')TabContent() {Text('我的内容').fontSize(30)}.tabBar("我的")}}.width('100%')}
}

顶部导航

Tabs({ barPosition: BarPosition.Start })

侧边导航

Tabs({ barPosition: BarPosition.Start }) {}
.vertical(true)
.barWidth(100)
.barHeight('100%')

限制导航栏的滑动切换

.scrollable(false)

固定导航栏・可滚动导航栏

.barMode(BarMode.Fixed) // 固定导航栏
.barMode(BarMode.Scrollable) // 可滚动导航栏

自定义导航栏

@Entry
@Component
struct Bujv_tabs {@State currentIndex: number = 0@BuildertabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) {Column() {Image(this.currentIndex === targetIndex ? selectedImg : normalImg).size({ width: 25, height: 25 })Text(title).fontColor(this.currentIndex === targetIndex ? Color.Red : Color.Black)}.width('100%').height(50).justifyContent(FlexAlign.Center)}build() {Column() {Tabs({ barPosition: BarPosition.Start }) {TabContent() {Column() {Text('我的内容')}.width('100%').height('100%').backgroundColor(Color.Pink)}.tabBar(this.tabBuilder('我的', 0, $r('app.media.fuel'), $r('app.media.foods')))}}.width('100%')}
}

切换至指定页签

在使用了自定义导航栏后,默认的Tabs仅实现滑动内容页和点击页签时内容页的切换逻辑,页签的切换逻辑需要自行实现。

@Entry
@Component
struct Bujv_tabs {@State currentIndex: number = 2@BuildertabBuilder(title: string, targetIndex: number) {Column() {Text(title).fontColor(this.currentIndex === targetIndex ? '#1698CE' : '#6B6B6B')}}build() {Column() {Tabs({ barPosition: BarPosition.End }) {TabContent() {Text('首页的内容').fontSize(30)}.tabBar(this.tabBuilder('首页', 0))TabContent() {Text('推荐的内容').fontSize(30)}.tabBar(this.tabBuilder('推荐', 1))TabContent() {Text('发现的内容').fontSize(30)}.tabBar(this.tabBuilder('发现', 2))TabContent() {Text('我的内容').fontSize(30)}.tabBar(this.tabBuilder("我的", 3))}.animationDuration(2).backgroundColor('#F1F3F5').onChange((index: number) => {this.currentIndex = index})}.width('100%')}
}

TabsController是Tabs组件的控制器,用于控制Tabs组件进行内容页切换。

@Entry
@Component
struct Bujv_tabs {@State currentIndex: number = 2private controller: TabsController = new TabsController()@BuildertabBuilder(title: string, targetIndex: number) {Column() {Text(title).fontColor(this.currentIndex === targetIndex ? '#1698CE' : '#6B6B6B')}}build() {Column() {Tabs({ barPosition: BarPosition.End, index: this.currentIndex, controller: this.controller }) {TabContent() {Text('首页的内容').fontSize(30)}.tabBar(this.tabBuilder('首页', 0))TabContent() {Text('推荐的内容').fontSize(30)}.tabBar(this.tabBuilder('推荐', 1))TabContent() {Text('发现的内容').fontSize(30)}.tabBar(this.tabBuilder('发现', 2))TabContent() {Text('我的内容').fontSize(30)}.tabBar(this.tabBuilder("我的", 3))}.animationDuration(2).backgroundColor('#F1F3F5').height(600).onChange((index: number) => {this.currentIndex = index})Button('动态修改index').width('50%').margin({ top: 20 }).onClick(() => {this.currentIndex = (this.currentIndex + 1) % 4})Button('changeIndex').width('50%').margin({ top: 20 }).onClick(() => {let index = (this.currentIndex + 1) % 4this.controller.changeIndex(index)})}.width('100%')}
}
http://www.ds6.com.cn/news/92704.html

相关文章:

  • 做外汇需要关注的新闻网站安卓优化大师官方版
  • wordpress拖动建站郑州seo全网营销
  • 网站基本架构设计的主要步骤外链网盘源码
  • 网站建设厌倦社会新闻最新消息
  • s网站建设兰州正规seo整站优化
  • 深圳市龙华区教育局官网台州关键词优化平台
  • 请上传网站应用水印图片亚马逊关键词优化软件
  • 群晖ds1817做网站郑州百度网站快速优化
  • 英文网站建设600网络推广教程
  • 网站建设网络推广公司有哪些搜索引擎优化大致包含哪些内容或环节
  • 大连精美网站制作企业培训计划方案
  • 大型网站设计方案做网站的外包公司
  • 做淘客app要网站吗培训中心
  • 武汉政鑫建设有限公司网站湖北网站建设制作
  • 政府部门网站建设的重要意义互联网营销师培训
  • 安徽城乡建设委员会的网站网站如何进行优化
  • 网站建设公司 销量app安装下载
  • 网站做外部链接互联网100个创业项目
  • 有ip地址如何做网站2345网址导航用户中心
  • 怎样用云服务器做网站2023引流软件
  • 文具网站建设理念游戏推广员到底犯不犯法
  • 帝国cms网站公告怎么做希爱力吃一颗能干多久
  • 做销售网站多少钱企业整站优化
  • 做网商必备网站网页模板建站系统
  • 北京做企业网站网站推广的方式有哪些?
  • 万州网站制作公司电脑培训班零基础
  • 摄影作品网站排行榜2023很有可能再次封城吗
  • 在线旅游攻略网站建设方案app开发工具哪个好
  • 跟随网站滚动的悬浮框怎么做免费发布信息的平台有哪些
  • 网站建设 中企动力厨具怎么买域名自己做网站