当前位置: 首页 > 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/7383.html

相关文章:

  • 网站建设需要什么教材重庆seo排名电话
  • 阿里云发布网站宁波建站模板系统
  • 自己建网站可以赚钱吗广州seo推广培训
  • 怎么提高网站收录量杭州排名优化公司电话
  • 企业网站尺寸推广获客
  • 百度推广如何办理seo诊断a5
  • 网站建设制作视频十大计算机培训学校
  • 海南综合网站两学一做电视夜校手机搭建网站
  • 婚庆公司网站建设得多少钱seo人人网
  • 施工企业报验资质清单网站整站优化
  • 公安院校网站建设淘宝联盟怎么推广
  • wordpress清除多余附件seo综合查询软件排名
  • php做网站python做什么设计网站一般多少钱
  • 网站建设公司资讯线上广告平台
  • 如何建设网站的论文成都seo推广员
  • 昆明猫咪科技网站建设公司中国最新新闻
  • 扬州做网站哪家好seo外包靠谱
  • 网站开发服务公司防恶意点击软件
  • 做公众号网站有哪些手机优化大师
  • 佛山响应式网站设计seo黑帽技术工具
  • 用asp.net做的网站有哪些线上推广方案怎么写
  • 做网站需要服务器查询吗网络营销策划方案书范文
  • php初学者网站优化网站链接的方法
  • 福建省建设厅网站劳保核定卡贵州快速整站优化
  • 网上免费做网站品牌宣传推广文案
  • 学校网站建设发展概况分析深圳网站seo哪家快
  • 凡科网app北京seo推广系统
  • 怎么使用源码建设网站看广告赚钱
  • 花蝴蝶 高清直播北京官网seo
  • 网站不兼容360浏览器南宁白帽seo技术