鸿蒙 tabs 底部中间凸出

news2024/9/23 17:48:11

1, 先看效果

2, 直接cv代码-- 先修改一下 资源配置 图标使用自己的

color.json配置

{
  "integer": [
    {
      "name": "tab_row_column_image_width",
      "value": 24
    },
    {
      "name": "tab_row_column_image_height",
      "value": 24
    },
    {
      "name": "tab_row_column_text_font_size",
      "value": 10
    },
    {
      "name": "tab_row_column_width",
      "value": 50
    },
    {
      "name": "tab_row_column_height",
      "value": 100
    },
    {
      "name": "tab_row_offset",
      "value": -60
    },
    {
      "name": "tab_interval_number",
      "value": 20
    },
    {
      "name": "tab_image_width",
      "value": 50
    },
    {
      "name": "tab_image_height",
      "value": 50
    },
    {
      "name": "tab_text_size",
      "value": 20
    },
    {
      "name": "tab_margin_small",
      "value": 10
    },
    {
      "name": "tabs_bar_height",
      "value": 0
    },
    {
      "name": "tab_upgrade_text_font_size",
      "value": 14
    },
    {
      "name": "tab_upgrade_icon_size",
      "value": 14
    },
    {
      "name": "tab_mus_font_size",
      "value": 12
    },
    {
      "name": "tab_max_line",
      "value": 1
    },
    {
      "name": "tab_mus_height",
      "value": 20
    },
    {
      "name": "tab_upgrade_margin",
      "value": 4
    },
    {
      "name": "tab_upgrade_height",
      "value": 36
    },
    {
      "name": "tab_upgrade_padding",
      "value": 12
    },
    {
      "name": "tab_search_icon_width",
      "value": 20
    },
    {
      "name": "tab_search_icon_height",
      "value": 20
    },
    {
      "name": "tab_tab_font_size",
      "value": 16
    },
    {
      "name": "tab_tab_divider_width",
      "value": 30
    },
    {
      "name": "tab_divider_margin_top",
      "value": 5
    },
    {
      "name": "tab_side_margin_top",
      "value": -20
    },
    {
      "name": "tab_video_des_margin_bottom",
      "value": 2
    },
    {
      "name": "tab_play_time_text_font_size",
      "value": 20
    },
    {
      "name": "tab_play_time_text_width",
      "value": 100
    },
    {
      "name": "tab_play_time_text_height",
      "value": 30
    },
    {
      "name": "tab_play_time_text_margin",
      "value": -100
    },
    {
      "name": "tab_text1_height",
      "value": 5
    },
    {
      "name": "tab_text1_touch_height",
      "value": 10
    },
    {
      "name": "tab_text1_borderradius",
      "value": 5
    },
    {
      "name": "tab_text1_touch_border_radius",
      "value": 0
    },
    {
      "name": "tab_text1_margin_top",
      "value": -5
    },
    {
      "name": "tab_text1_margin_left",
      "value": 15
    },
    {
      "name": "tab_text3_width",
      "value": 12
    },
    {
      "name": "tab_text3_height",
      "value": 12
    },
    {
      "name": "tab_text3_border_radius",
      "value": 6
    },
    {
      "name": "tab_tabbar_height",
      "value": 60
    },
    {
      "name": "tab_head_image_width",
      "value": 45
    },
    {
      "name": "tab_head_image_height",
      "value": 45
    },
    {
      "name": "tab_head_image_border_width",
      "value": 1
    },
    {
      "name": "tab_focus_image_width",
      "value": 20
    },
    {
      "name": "tab_focus_image_height",
      "value": 20
    },
    {
      "name": "tab_focus_image_border_radius",
      "value": 20
    },
    {
      "name": "tab_focus_image_margin",
      "value": -10
    },
    {
      "name": "tab_like_image_width",
      "value": 35
    },
    {
      "name": "tab_like_image_height",
      "value": 30
    },
    {
      "name": "tab_like_image_margin_top",
      "value": 18
    },
    {
      "name": "tab_like_text_font_size",
      "value": 10
    },
    {
      "name": "tab_like_text_margin_top",
      "value": 5
    },
    {
      "name": "tab_relativecontainer_width",
      "value": 60
    },
    {
      "name": "tab_relativecontainer_height",
      "value": 330
    },
    {
      "name": "tab_name_text_font_size",
      "value": 18
    },
    {
      "name": "tab_name_text_margin_left",
      "value": 10
    },
    {
      "name": "tab_des_text_font_size",
      "value": 14
    },
    {
      "name": "tab_des_text_margin_top",
      "value": 5
    },
    {
      "name": "tab_des_text_padding_left",
      "value": 10
    },
    {
      "name": "tab_time_text_font_size",
      "value": 10
    },
    {
      "name": "tab_gray_background_margin_top",
      "value": 16
    },
    {
      "name": "tab_upgrade_filled_margin_top",
      "value": 8
    },
    {
      "name": "tab_arrow_right_margin_right",
      "value": 10
    },
    {
      "name": "tab_divider_margin_right",
      "value": 5
    },
    {
      "name": "tab_video_des_relativecontainer_height",
      "value": 106
    },
    {
      "name": "tab_search_image_margin",
      "value": 20
    },
    {
      "name": "tab_top_view_relativecontainer_height",
      "value": 50
    },
    {
      "name": "tab_top_view_divider_margin_top",
      "value": 3
    },
    {
      "name": "tab_top_view_divider_margin_left",
      "value": -15
    },
    {
      "name": "tab_white_top",
      "value": 4
    }
  ]
}

float.json配置

{
  "float": [
    {
      "name": "mainPage_baseTab_size",
      "value": "24vp"
    },
    {
      "name": "mainPage_baseTab_top",
      "value": "4vp"
    },
    {
      "name": "mainPage_barHeight",
      "value": "52vp"
    },
    {
      "name": "rudder_barHeight",
      "value": "90vp"
    },
    {
      "name": "tab_text_font_size",
      "value": "10fp"
    },
    {
      "name": "content_font_size",
      "value": "30fp"
    },
    {
      "name": "title_font_size",
      "value": "30fp"
    },
    {
      "name": "text_size",
      "value": "16fp"
    },
    {
      "name": "double_text_size",
      "value": "18fp"
    },
    {
      "name": "current_text_size",
      "value": "20fp"
    },
    {
      "name": "back_text_size",
      "value": "14fp"
    },
    {
      "name": "text_line_height",
      "value": "22vp"
    },
    {
      "name": "divider_width",
      "value": "48vp"
    },
    {
      "name": "opacity_1",
      "value": "1"
    },
    {
      "name": "opacity_0",
      "value": "0"
    },
    {
      "name": "list_friction",
      "value": "0.6"
    },
    {
      "name": "size_text",
      "value": "16vp"
    },
    {
      "name": "margin_drawer_list",
      "value": "4vp"
    },
    {
      "name": "margin_tab_text",
      "value": "6vp"
    },
    {
      "name": "margin_under_tab",
      "value": "7vp"
    },
    {
      "name": "margin_eight",
      "value": "8vp"
    },
    {
      "name": "margin_index_top",
      "value": "14vp"
    },
    {
      "name": "margin_sixteen",
      "value": "16vp"
    },
    {
      "name": "margin_list",
      "value": "17vp"
    },
    {
      "name": "margin_index_bottom",
      "value": "18vp"
    },
    {
      "name": "margin_slide_top",
      "value": "40vp"
    },
    {
      "name": "margin_button_bottom",
      "value": "48vp"
    },
    {
      "name": "margin_side_tab_top",
      "value": "74vp"
    },
    {
      "name": "margin_sidebar_content",
      "value": "284vp"
    },
    {
      "name": "padding_double_tab_left",
      "value": "4vp"
    },
    {
      "name": "padding_rudder_tab",
      "value": "11vp"
    },
    {
      "name": "padding_bottom_tab",
      "value": "12vp"
    },
    {
      "name": "padding_drawer_row",
      "value": "13vp"
    },
    {
      "name": "padding_index_top",
      "value": "44vp"
    },
    {
      "name": "drawer_padding",
      "value": "104vp"
    }
  ]
}

integer.json 配置

{
  "integer": [
    {
      "name": "tab_row_column_image_width",
      "value": 24
    },
    {
      "name": "tab_row_column_image_height",
      "value": 24
    },
    {
      "name": "tab_row_column_text_font_size",
      "value": 10
    },
    {
      "name": "tab_row_column_width",
      "value": 50
    },
    {
      "name": "tab_row_column_height",
      "value": 100
    },
    {
      "name": "tab_row_offset",
      "value": -60
    },
    {
      "name": "tab_interval_number",
      "value": 20
    },
    {
      "name": "tab_image_width",
      "value": 50
    },
    {
      "name": "tab_image_height",
      "value": 50
    },
    {
      "name": "tab_text_size",
      "value": 20
    },
    {
      "name": "tab_margin_small",
      "value": 10
    },
    {
      "name": "tabs_bar_height",
      "value": 0
    },
    {
      "name": "tab_upgrade_text_font_size",
      "value": 14
    },
    {
      "name": "tab_upgrade_icon_size",
      "value": 14
    },
    {
      "name": "tab_mus_font_size",
      "value": 12
    },
    {
      "name": "tab_max_line",
      "value": 1
    },
    {
      "name": "tab_mus_height",
      "value": 20
    },
    {
      "name": "tab_upgrade_margin",
      "value": 4
    },
    {
      "name": "tab_upgrade_height",
      "value": 36
    },
    {
      "name": "tab_upgrade_padding",
      "value": 12
    },
    {
      "name": "tab_search_icon_width",
      "value": 20
    },
    {
      "name": "tab_search_icon_height",
      "value": 20
    },
    {
      "name": "tab_tab_font_size",
      "value": 16
    },
    {
      "name": "tab_tab_divider_width",
      "value": 30
    },
    {
      "name": "tab_divider_margin_top",
      "value": 5
    },
    {
      "name": "tab_side_margin_top",
      "value": -20
    },
    {
      "name": "tab_video_des_margin_bottom",
      "value": 2
    },
    {
      "name": "tab_play_time_text_font_size",
      "value": 20
    },
    {
      "name": "tab_play_time_text_width",
      "value": 100
    },
    {
      "name": "tab_play_time_text_height",
      "value": 30
    },
    {
      "name": "tab_play_time_text_margin",
      "value": -100
    },
    {
      "name": "tab_text1_height",
      "value": 5
    },
    {
      "name": "tab_text1_touch_height",
      "value": 10
    },
    {
      "name": "tab_text1_borderradius",
      "value": 5
    },
    {
      "name": "tab_text1_touch_border_radius",
      "value": 0
    },
    {
      "name": "tab_text1_margin_top",
      "value": -5
    },
    {
      "name": "tab_text1_margin_left",
      "value": 15
    },
    {
      "name": "tab_text3_width",
      "value": 12
    },
    {
      "name": "tab_text3_height",
      "value": 12
    },
    {
      "name": "tab_text3_border_radius",
      "value": 6
    },
    {
      "name": "tab_tabbar_height",
      "value": 60
    },
    {
      "name": "tab_head_image_width",
      "value": 45
    },
    {
      "name": "tab_head_image_height",
      "value": 45
    },
    {
      "name": "tab_head_image_border_width",
      "value": 1
    },
    {
      "name": "tab_focus_image_width",
      "value": 20
    },
    {
      "name": "tab_focus_image_height",
      "value": 20
    },
    {
      "name": "tab_focus_image_border_radius",
      "value": 20
    },
    {
      "name": "tab_focus_image_margin",
      "value": -10
    },
    {
      "name": "tab_like_image_width",
      "value": 35
    },
    {
      "name": "tab_like_image_height",
      "value": 30
    },
    {
      "name": "tab_like_image_margin_top",
      "value": 18
    },
    {
      "name": "tab_like_text_font_size",
      "value": 10
    },
    {
      "name": "tab_like_text_margin_top",
      "value": 5
    },
    {
      "name": "tab_relativecontainer_width",
      "value": 60
    },
    {
      "name": "tab_relativecontainer_height",
      "value": 330
    },
    {
      "name": "tab_name_text_font_size",
      "value": 18
    },
    {
      "name": "tab_name_text_margin_left",
      "value": 10
    },
    {
      "name": "tab_des_text_font_size",
      "value": 14
    },
    {
      "name": "tab_des_text_margin_top",
      "value": 5
    },
    {
      "name": "tab_des_text_padding_left",
      "value": 10
    },
    {
      "name": "tab_time_text_font_size",
      "value": 10
    },
    {
      "name": "tab_gray_background_margin_top",
      "value": 16
    },
    {
      "name": "tab_upgrade_filled_margin_top",
      "value": 8
    },
    {
      "name": "tab_arrow_right_margin_right",
      "value": 10
    },
    {
      "name": "tab_divider_margin_right",
      "value": 5
    },
    {
      "name": "tab_video_des_relativecontainer_height",
      "value": 106
    },
    {
      "name": "tab_search_image_margin",
      "value": 20
    },
    {
      "name": "tab_top_view_relativecontainer_height",
      "value": 50
    },
    {
      "name": "tab_top_view_divider_margin_top",
      "value": 3
    },
    {
      "name": "tab_top_view_divider_margin_left",
      "value": -15
    },
    {
      "name": "tab_white_top",
      "value": 4
    }
  ]
}

3, 页面配置--新建3个页面

Constants.ets

export class Constants {
  /**
   * Index content width.
   */
  static readonly INDEX_CONTENT_WIDTH: string = '91.1%';
  /**
   * Index divider height.
   */
  static readonly DIVIDER_HEIGHT: number = 0.5;
  /**
   * Index divider width.
   */
  static readonly DIVIDER_WIDTH: string = '93%';
  /**
   * Drawer divider width.
   */
  static readonly DIVIDER_DRAWER_WIDTH: string = '90%';
  /**
   * Card title height.
   */
  static readonly CARD_TITLE_HEIGHT: number = 20;
  /**
   * Card text height.
   */
  static readonly CARD_TEXT_HEIGHT: number = 48;
  /**
   * Index title height.
   */
  static readonly INDEX_TITLE_HEIGHT: number = 112;
  /**
   * Full screen width.
   */
  static readonly FULL_WIDTH: string = '100%';
  /**
   * Full screen height.
   */
  static readonly FULL_HEIGHT: string = '100%';
  /**
   * Font size of unchecked title.
   */
  static readonly FONT_SIZE_UNCHECKED = 18;
  /**
   * Font size of checked title.
   */
  static readonly FONT_SIZE_CHECKED: number = 24;
  /**
   * Content height.
   */
  static readonly CONTENT_HEIGHT: number = 300;
  /**
   * List height.
   */
  static readonly LIST_HEIGHT: number = 48;
  /**
   * List card width.
   */
  static readonly LIST_CARD_WIDTH: number = 272;
  /**
   * List card height.
   */
  static readonly LIST_CARD_HEIGHT: number = 344;
  /**
   * List content height.
   */
  static readonly LIST_CONTENT_HEIGHT: string = '110%';
  /**
   * Background tab height.
   */
  static readonly BACKGROUND_TAB_HEIGHT: number = 40;
  /**
   * Index button height.
   */
  static readonly INDEX_BUTTON_HEIGHT: number = 60;
  /**
   * Background tab width.
   */
  static readonly BACKGROUND_TAB_WIDTH: number = 96;
  /**
   * Drawer width.
   */
  static readonly DRAWER_WIDTH: number = 264;
  /**
   * Sub tab width.
   */
  static readonly SUB_TAB_WIDTH: number = 56;
  /**
   * Sub slide width.
   */
  static readonly SUB_SLIDE_TAB_WIDTH: number = 56;
  /**
   * Sub tab bottom height.
   */
  static readonly SUB_TAB_BOT_HEIGHT: number = 25;
  /**
   * Sub tab width.
   */
  static readonly SUB_TAB_HEIGHT: number = 30;
  /**
   * Sub list width.
   */
  static readonly SUB_LIST_WIDTH: string = '85%';
  /**
   * Side tab width.
   */
  static readonly SIDE_TAB_WIDTH: string = '27.8%';
  /**
   * Side contend width.
   */
  static readonly SIDE_CONTEND_WIDTH: string = '72.2%';
  /**
   * Tab index0.
   */
  static readonly TAB_INDEX_ZERO: number = 0;
  /**
   * Tab index1.
   */
  static readonly TAB_INDEX_ONE: number = 1;
  /**
   * Tab index2.
   */
  static readonly TAB_INDEX_TWO: number = 2;
  /**
   * Tab index3.
   */
  static readonly TAB_INDEX_THREE: number = 3;
  /**
   * Tab index4.
   */
  static readonly TAB_INDEX_FOUR: number = 4;
  /**
   * Tab index5.
   */
  static readonly TAB_INDEX_FIVE: number = 5;
  /**
   * Image tab size.
   */
  static readonly IMAGE_SIZE_TAB: number = 22;
  /**
   * Image middle size.
   */
  static readonly IMAGE_SIZE_MIDDLE: number = 56;
  /**
   * More image width.
   */
  static readonly MORE_IMAGE_WIDTH: number = 20;
  /**
   * More image height.
   */
  static readonly MORE_IMAGE_HEIGHT: number = 15;
  /**
   * Drawer image height or width.
   */
  static readonly DRAWER_IMAGE_HEIGHT_WIDTH: number = 24;
  /**
   * List image height or width.
   */
  static readonly LIST_IMAGE_HEIGHT_WIDTH: number = 40;
  /**
   * Image offset.
   */
  static readonly IMAGE_OFFSET: number = -15;
  /**
   * Icon offset.
   */
  static readonly ICON_Offset: number = -3;
  /**
   * Animation duration.
   */
  static readonly ANIMATION_DURATION: number = 300;
  /**
   * Margin sixteen.
   */
  static readonly MARGIN_SIXTEEN: number = 16;
  /**
   * Margin button top.
   */
  static readonly MARGIN_BUTTON_TOP: number = 48;
  /**
   * Translate top.
   */
  static readonly TRANSLATE_TOP: number = -40;
  /**
   * Translate bottom.
   */
  static readonly TRANSLATE_BOTTOM: number = 40;
  /**
   * Border radius drawer.
   */
  static readonly BORDER_RADIUS_DRAWER: number = 16;
  /**
   * Border radius index list.
   */
  static readonly BORDER_RADIUS_INDEX_LIST: number = 18;
  /**
   * Border radius drawer content.
   */
  static readonly BORDER_RADIUS_DRAWER_CONTENT: number = 20;
  /**
   * Border radius back tab.
   */
  static readonly BORDER_RADIUS_BACK_TAB: number = 21;
  /**
   * Divider strokeWidth.
   */
  static readonly STROKE_WIDTH: number = 2;
  /**
   * Slice index index0.
   */
  static readonly SLICE_INDEX_ZERO: number = 0;
  /**
   * Slice index index6.
   */
  static readonly SLICE_INDEX_SIX: number = 6;
  /**
   * fontWeight.
   */
  static readonly FONT_WEIGHT_TAB: number = 600;
  /**
   * TopTabData.
   */
  static readonly TOP_TAB_DATA: string[] = ['文学', '交友', '直播', '视频', '盛典', '潮玩'];
  /**
   * Routes.
   */
  static readonly ROUTES: Route[] = [
    {
      title: '底部导航',
      child: [
        {
          text: '常见底部导航',
          to: 'BottomTab'
        },
        {
          text: '舵式底部导航',
          to: 'RudderStyleTab'
        },
        {
          text: 'TabContent视频内容滑动并在Tabbar上显示',
          to: 'TabContentOverflow'
        }
      ]
    },
    {
      title: '顶部导航',
      child: [
        {
          text: '下划线样式',
          to: 'UnderlineTab'
        },
        {
          text: '背景高亮样式',
          to: 'BackgroundLightTab'
        },
        {
          text: '文字样式',
          to: 'WordTab'
        },
        {
          text: '双层嵌套样式实现1',
          to: 'DoubleNestingTabOne'
        },
        {
          text: '双层嵌套样式实现2',
          to: 'DoubleNestingTabTwo'
        },
        {
          text: '可滑动+更多按钮',
          to: 'SlideAndMoreTab'
        }
      ]
    },
    {
      title: '侧边导航',
      child: [
        {
          text: '常见侧边导航',
          to: 'SideTab'
        },
        {
          text: '抽屉式侧边导航',
          to: 'DrawerTab'
        }
      ]
    }
  ]
}

/**
 * Route type define.
 */
export interface Route {
  title: string,
  child: Array<ChildRoute>
}

/**
 * ChildRoute type define.
 */
export interface ChildRoute {
  text: string,
  to: string
}

Index.ets

import { initTabTuData } from './TabViewModel';
import { BottomTabModel } from './TabItem';
import { Constants } from './Constants';

@Entry
@Component
struct OstrichStyleTab {
  @State tabArray: Array<BottomTabModel> = initTabTuData();
  @State currentIndex: number = 0;
  @State iconOffset: number = 0;
  @State initNumber: number = 0;
  private controller: TabsController = new TabsController();

  @Builder
  Tab(selectImage: Resource, defaultImage: Resource, title: string, middleMode: boolean, index: number) {
    Column() {
      if (index === Constants.TAB_INDEX_TWO) {
        Image(defaultImage)
          .size({ width: Constants.IMAGE_SIZE_MIDDLE, height: Constants.IMAGE_SIZE_MIDDLE })
          .offset({ y: Constants.IMAGE_OFFSET })
      } else {
        Image(this.currentIndex === index ? selectImage : defaultImage)
          .size({ width: Constants.IMAGE_SIZE_TAB, height: Constants.IMAGE_SIZE_TAB })
          .offset({
            y: (this.currentIndex === index && this.currentIndex !== Constants.TAB_INDEX_TWO)
              ? this.iconOffset : this.initNumber
          })
          .objectFit(ImageFit.Contain)
          .animation({
            duration: Constants.ANIMATION_DURATION,
            curve: Curve.Ease,
            playMode: PlayMode.Normal
          })
      }

      if (!middleMode) {
        Text(title)
          .fontSize($r('app.float.tab_text_font_size'))
          .margin({ top: $r('app.float.margin_tab_text') })
          .fontColor(this.currentIndex === index ? $r('app.color.current_color') : $r('app.color.text_color'))
      }
    }
    .padding({ top: $r('app.float.padding_rudder_tab') })
    .width(Constants.FULL_WIDTH)
    .backgroundColor($r('app.color.tab_color'))
    .height($r('app.float.rudder_barHeight'))
    .translate({ y: Constants.TRANSLATE_BOTTOM })
    .onClick(() => {
      if (index !== Constants.TAB_INDEX_TWO) {
        this.currentIndex = index;
        this.controller.changeIndex(index);
        this.iconOffset = Constants.ICON_Offset;
      }
    })
  }

  build() {
    Column() {
      Stack({ alignContent: Alignment.BottomStart }) {
        Tabs({ barPosition: BarPosition.End, controller: this.controller }) {
          ForEach(this.tabArray, (item: BottomTabModel, index: number) => {
            if (index === Constants.TAB_INDEX_TWO) {
              TabContent() {
              }
              .backgroundColor(Color.White)
            } else {
              TabContent() {
                Row() {
                  Text(item.title)
                    .fontSize($r('app.float.content_font_size'))
                }
                .height(Constants.CONTENT_HEIGHT)
                .width(Constants.FULL_WIDTH)
                .justifyContent(FlexAlign.Center)
              }
              .backgroundColor(Color.White)
            }
          }, (item: BottomTabModel, index: number) => JSON.stringify(item) + index)
        }
        .scrollable(false)
        .barHeight(this.initNumber)
        .animationDuration(Constants.ANIMATION_DURATION)

        Flex() {
          ForEach(this.tabArray, (item: BottomTabModel, index: number) => {
            this.Tab(item.selectImage, item.defaultImage, item.title, item.middleMode, index)
          }, (item: BottomTabModel, index: number) => JSON.stringify(item) + index)
        }
        .backgroundColor('#00090a1c')
        .margin({
          top: '0.00vp',
          right: '0.00vp',
          bottom: '0',
          left: '0.00vp'
        })
      }
    }
    .height(Constants.FULL_HEIGHT)
  }
}

TabItem.ets

export class TabItem {
  id: number;
  name: string;

  constructor(id: number, name: string) {
    this.id = id;
    this.name = name;
  }
}

export class BottomTabModel {
  selectImage: Resource;
  defaultImage: Resource;
  middleMode: boolean;
  title: string;
  isSelected: boolean = false;

  constructor(selectImage: Resource, defaultImage: Resource, title: string, middleMode = false) {
    this.selectImage = selectImage;
    this.defaultImage = defaultImage;
    this.title = title;
    this.middleMode = middleMode;
  }
}

TabViewModel.ets

/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { BottomTabModel, TabItem } from './TabItem';

export function initTabData(): TabItem[] {
  let tabDataArray: TabItem[] = [];

  return tabDataArray;
}

export function initTabTuData(): BottomTabModel[] {
  let tabTuDataArray: BottomTabModel[] = [];
  TabTuItemData.forEach((item: BottomTabModel) => {
    tabTuDataArray.push(new BottomTabModel(item.defaultImage, item.selectImage, item.title, item.middleMode));
  })
  return tabTuDataArray;
}


const TabTuItemData: BottomTabModel[] = [
  new BottomTabModel($r('app.media.home'), $r('app.media.activeHome'), '首页'),
  new BottomTabModel($r('app.media.star'), $r('app.media.activeStar'), '动态'),
  new BottomTabModel($r('app.media.activePlus'), $r('app.media.activePlus'), '', true),
  new BottomTabModel($r('app.media.message'), $r('app.media.activeMessage'), '消息'),
  new BottomTabModel($r('app.media.people'), $r('app.media.activePeople'), '我的')
]

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2093556.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Vue面试常见知识总结2——spa、vue按需加载、mvc与mvvm、vue的生命周期、Vue2与Vue3区别

SPA SPA&#xff08;Single Page Application&#xff0c;单页面应用&#xff09;是一种Web应用程序架构&#xff0c;其核心特点是在用户与应用程序交互时&#xff0c;不重新加载整个页面&#xff0c;而是通过异步加载页面的局部内容或使用JavaScript动态更新页面。以下是对SPA…

【QT】增加注释模板

为了增加项目可读性&#xff0c;增加注释模板 选择工具->外部->配置… &#xff0c;再次选择“文本编辑器”->“片段”->“添加”&#xff0c;触发命名为header_customer,点击应用&#xff0c;按照下面的模板编排,再次点击应用&#xff0c; /*******************…

【第0004页 · 递归】生成括号对

【前言】本文以及之后的一些题解都会陆续整理到目录中&#xff0c;若想了解全部题解整理&#xff0c;请看这里&#xff1a; 第0004页 生成括号对 今天这题有点难绷&#xff0c;从某种程度上来说应该是第二次写这个问题了&#xff0c;但还是卡住了&#xff0c;现在我们来看一下…

2018CCPC网络赛 C - Dream

题意 给定一个P,现在可以以任意方式重载‘’和‘*’两个符号,使得满足下列等式 其中定义如下 需要注意的是,重载过后的*需要满足以下要求: 也就是说,重载‘*’之后通过计算得到的(k1,2,3,...,p-1)的取值对于集合{1,2,3,...,p-1}是一个一一映射的关系 ​​​​最后输出2*p行,按…

如何在windows中使用hfd.sh aria2c下载huggingface文件

这里写目录标题 简介hfd.sh使用方法windows系统安装aria2c aria2c官方文档&#xff1a; https://aria2.github.io/manual/en/html/aria2c.html 简介 我们在下载huggingface上模型权重的时候&#xff0c;要么在浏览器上直接下&#xff0c;要么使用官方下载程序。浏览器上还得一…

Lagent 自定义 Agent 智能体

准备 安安装环境 mindsearch 工具 画图工具

算法设计与分析:实验五 图论——桥问题

实验内容&#xff1a; 1. 桥的定义 在图论中&#xff0c;一条边被称为“桥”代表这条边一旦被删除&#xff0c;这张图的连通块数量会增加。等价地说&#xff0c;一条边是一座桥当且仅当这条边不在任何环上。一张图可以有零或多座桥。 2. 求解问题 找出一个无向图中所有的桥…

用MATLAB 画一个64QAM的星座图

由于QAM采用幅度和相位二维调制&#xff0c;其频谱效率大大提高&#xff0c;而且不同点的欧式距离也要大于调幅AM调制方式&#xff0c;QAM也是LTE和5G NR首选的调制方式&#xff0c;本期教大家画一个64QAM的星座图。 如下&#xff1a; 首先产生一个64QAM的调制数据&#xff0…

18044 成绩等级评分

### 思路 1. 从键盘输入一个整数成绩。 2. 判断成绩是否在0到100之间&#xff1a; - 如果不在范围内&#xff0c;输出“error”。 - 如果在范围内&#xff0c;根据成绩范围输出对应的等级&#xff1a; - 90分以上为A - 80到89分为B - 70到79分为C - …

数仓架构:离线数仓、实时数仓Lambda和Kappa、湖仓一体数据湖

往期推荐 大数据HBase图文简介-CSDN博客 数仓分层ODS、DWD、DWM、DWS、DIM、DM、ADS-CSDN博客 数仓常见名词解析和名词之间的关系-CSDN博客 目录 往期推荐 1. 数仓架构 1.1 离线数仓架构 1.1.1 数据集市架构 1.1.1.2 独立数据集市 1.1.1.2 从属数据集市 1.1.2 Inmon企…

Java的线程池简述

线程池的工作原理 线程池是为了减少频繁的创建线程和销毁线程带来的性能损耗&#xff0c;线程池的工作原理如下图&#xff1a; 线程池分为核心线程池&#xff0c;线程池的最大容量&#xff0c;还有等待任务的队列&#xff0c;提交一个任务&#xff0c;如果核心线程没有满&…

基于SpringBoot+Vue+MySQL的宠物寄养服务管理系统

系统背景 互联网社会的到来&#xff0c;让各行各业通过互联网实现了浴火重生的可能&#xff0c;每个行业都发现了完全可以使用互联网技术用来提高信息在内部的传递效率&#xff0c;提高管理水准。通过本次对宠物寄养服务系统的设计和开发&#xff0c;不仅能巩固已经学到的知识&…

代码随想录 刷题记录-22 动态规划(6)习题

1.300.最长递增子序列 子序列问题是动态规划解决的经典问题&#xff0c;当前下标i的递增子序列长度&#xff0c;其实和i之前的下标j的子序列长度有关系. 动规五部曲&#xff1a; 1.dp数组及下标含义 dp[i] : 从任意位置开始&#xff0c;以nums[i]元素作为结尾的所有 递增子…

Unity编辑器开发 Immediate Mode GUI (IMGUI)

1. 简介&#xff1a; IMGUI是代码驱动gui系统&#xff0c;由 OnGUI 函数驱动&#xff1a; void OnGUI() {if (GUILayout.Button("Press Me")){ Debug.Log("Hello!");} } IMGUI常用于&#xff1a; 创建 in-game debugging displays and tools&#xff1b…

Redis基础命令和事务,redis持久化和主从复制

目录 第一章、Redis数据库的下载和安装1.1&#xff09;nosql数据库和 Redis 介绍1.2&#xff09;Windows中下载安装Redis数据库1.3&#xff09;Linux中安装Redis数据库1.4&#xff09;Linux中启动redis1.5&#xff09;Linux中关闭redis 第二章、三种Redis客户端连接Redis数据库…

AI安全立法:加州新法案的争议与未来影响

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…

版本管理工具 Git 的下载安装及使用

1 基本介绍 Git 是目前最流行的分布式版本控制软件 什么是分布式版本控制软件&#xff1f; 所有版本信息仓库全部同步到本地的每个用户可以在本地查看所有版本历史&#xff0c;可以离线在本地提交&#xff0c;只需在连网时 push 到相应的服务器或其他用户那里。每个用户那里…

一键翻译全球:2024年跨文化交流的得力助手

翻译工具作为沟通不不同语言桥梁上的重要使者&#xff0c;正在从古老的字典查阅到现代的机器翻译软件发展。今天&#xff0c;让我们一同探索与搜狗翻译工具相似的翻译工具们怎么带我们走进奇妙世界。 1.福晰翻译 链接直达>>https://www.foxitsoftware.cn/fanyi/ 这款多…

数字芯片中I/O单元及电源domain布局中SIPI的考虑

芯片设计的物理实施过程通常也简称为布局布线&#xff08;P&R&#xff0c;Place-and-Route&#xff09;&#xff0c;布局一般被分为布局规划&#xff08;Floorplan&#xff09;和标准单元摆放&#xff08;Place&#xff09;两个过程。而其中的布局规划是芯片后端物理实现过…

用Starbound星际边界服务器开服联机

1、登录服务器&#xff08;百度莱卡云游戏面板&#xff09; 进入控制面板后会出现正在安装的界面&#xff0c;安装大约10分钟&#xff08;如长时间处于安装中请联系我们的客服人员&#xff09; 2、连接游戏 开机后等待服务器地址下方正常运行时间的表由黄色变成灰色并且在计时…