HomeDocs
Skip to main content

dlt.onTabReselected(function listener)

Introduction

Sets an event listener for when the tab bar is in the selected state at the bottom, and clicking the tab button again triggers an event.

Usage Restrictions

Supported in the basic library version 4.0.0 or higher.

Parameters

function listener The event listener function for the tab bar being clicked again.

Parameters for the function listener

Object res

PropertyTypeDescription
urlstringThe page path of the currently clicked tab.
successstring"true" - Listener set successfully
"false" - Listener set failed
errMsgstringReturned when the setting fails;
errMsg enumeration values:
1. Parameter error: T10001
2. set tab item failed, it's not a tab page: T10002

Example

// pages/index/index.js
Page({
onReady() {
dlt.onTabReselected(function (res) {
console.log('Listener setting result:', res);
});
},
});

In this example, the dlt.onTabReselected function is used to set a listener for the tab bar being clicked again. When the event occurs, you can handle it using the provided callback function, which receives information about the clicked tab.

Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.