目录

Navigation Bar

has.setNavigationBarTitle

has.setNavigationBarTitle(Object object)

Dynamically sets the title text of the current page.

Since: 1.0.0

Parameters

The input parameter is an object containing the following fields.

Name

Type

Default Value

Mandatory

Description

title

string

-

Yes

Title text to set.

success

function

-

No

Callback to be invoked when the API call is successful.

fail

function

-

No

Callback to be invoked when the API call fails.

complete

function

-

No

Callback to be invoked when the API call is complete, regardless of success or failure.

Example

has.setNavigationBarTitle({
  title: 'Current page',
  success: () => {
    console.log('setNavigationBarTitle success');
  },
  fail: () => {
    console.log('setNavigationBarTitle fail');
  }
});

has.setNavigationBarColor

has.setNavigationBarColor(Object object)

Dynamically sets the color of the navigation bar on the current page.

Since: 1.0.0

Parameters

The input parameter is an object containing the following fields.

Name

Type

Default Value

Mandatory

Description

frontColor

string

-

Yes

Foreground color, including the colors of buttons, titles, and status bars.

For HarmonyOS API 12, the value can be set to #000000 or #FFFFFF only when navigationStyle is set to custom for a window. Otherwise, only #000000 is supported.

For HarmonyOS API 13 or later, the value can be set to #000000 or #FFFFFF.

backgroundColor

string

-

Yes

Background color, which must be a hexadecimal value.

success

function

-

No

Callback to be invoked when the API call is successful.

fail

function

-

No

Callback to be invoked when the API call fails.

complete

function

-

No

Callback to be invoked when the API call is complete, regardless of success or failure.

Example

has.setNavigationBarColor({
  frontColor: '#000000',
  backgroundColor: '#ff0000'
});