# Interface
# Interaction
# showToast
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
showToast(Object object)
Displays a message prompt box.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| title | string | Yes | Content of the prompt | |
| icon | string | 'success' | No | Icon |
| image | string | No | Local path of the custom icon. image has higher priority than icon | |
| duration | number | 1500 | No | Display duration of the prompt (in milliseconds) |
| mask | boolean | false | No | Whether to display a transparent mask layer |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
Valid values for object.icon
| Value | Description |
|---|---|
| success | Display success icon. The title text can display up to two lines |
| loading | Display loading icon. The title text can display up to two lines |
| error | Display error icon. The title text can display up to two lines |
| none | Do not display an icon. The title text can display up to two lines |
Sample Code
ft.showToast({
title: 'Success',
icon: 'success',
duration: 2000
})
Note
- Only one of
ft.showLoadingandft.showToastcan be displayed at the same time ft.showToastshould be used in conjunction withft.hideToast
# showModal
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
showModal(Object object)
Displays a modal dialog.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| title | string | Yes | Title of the prompt | |
| content | string | Yes | Content of the prompt | |
| showCancel | boolean | true | No | Whether to show the cancel button |
| cancelText | string | 'Cancel' | No | Text for the cancel button |
| cancelColor | string | #000000 | No | Text color for the cancel button, must be a hexadecimal color string |
| confirmText | string | 'Confirm' | No | Text for the confirm button |
| confirmColor | string | #576B95 | No | Text color for the confirm button, must be a hexadecimal color string |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
object.success callback function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| confirm | boolean | true indicates the user clicked the confirm button |
| cancel | boolean | true indicates the user clicked the cancel button (Used on Android to distinguish between closing by mask click or cancel button click) |
Sample Code
ft.showModal({
title: 'Prompt',
content: 'This is a modal dialog',
success(res) {
if (res.confirm) {
console.log('User clicked confirm')
} else if (res.cancel) {
console.log('User clicked cancel')
}
}
})
# showLoading
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
showLoading(Object object)
Displays a loading prompt box. Requires actively calling ft.hideLoading to close the prompt box.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| title | string | Yes | Content of the prompt | |
| mask | boolean | false | No | Whether to display a transparent mask layer |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
Sample Code
ft.showLoading({
title: 'Loading',
})
setTimeout(function () {
ft.hideLoading()
}, 2000)
Note
- Only one of
ft.showLoadingandft.showToastcan be displayed at the same time ft.showLoadingshould be used in conjunction withft.hideLoading
# showActionSheet
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
showActionSheet(Object object)
Displays an action menu.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| itemList | Array.<string> | Yes | Text array for the buttons. Maximum array length is 6 | |
| itemColor | string | #000000 | No | Text color for the buttons |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
object.success callback function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| tapIndex | number | Index of the button clicked by the user, from top to bottom, starting from 0 |
Sample Code
ft.showActionSheet({
itemList: ['A', 'B', 'C'],
success(res) {
console.log(res.tapIndex)
},
fail(res) {
console.log(res.errMsg)
}
})
# hideToast
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
hideToast(Object object)
Hides the message prompt box.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
# hideLoading
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
hideLoading(Object object)
Hides the loading prompt box.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
# Navigation Bar
# showNavigationBarLoading
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
showNavigationBarLoading(Object object)
Displays the navigation bar loading animation on the current page.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
# setNavigationBarTitle
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
setNavigationBarTitle(Object object)
Dynamically sets the title of the current page.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| title | string | Yes | Page title | |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
Sample Code
ft.setNavigationBarTitle({
title: 'Page Title'
})
# setNavigationBarColor
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
setNavigationBarColor(Object object)
Sets the navigation bar color of the page.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| frontColor | string | Yes | Foreground color value, including the color of buttons, title, and status bar. Only supports #ffffff and #000000 | |
| backgroundColor | string | Yes | Background color value. Valid values are hexadecimal colors | |
| animation | Object | Yes | Animation effect | |
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
Structure of object.animation
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| duration | number | 0 | No | Animation duration, in milliseconds |
| timingFunc | string | 'linear' | No | Animation timing function |
Valid values for object.animation.timingFunc
| Value | Description |
|---|---|
| 'linear' | The animation has the same speed from start to end |
| 'easeIn' | The animation starts at a low speed |
| 'easeOut' | The animation ends at a low speed |
| 'easeInOut' | The animation starts and ends at a low speed |
Sample Code
ft.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#ff0000',
animation: {
duration: 400,
timingFunc: 'easeIn'
}
})
# hideNavigationBarLoading
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
hideNavigationBarLoading(Object object)
Hides the navigation bar loading animation on the current page.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
# hideHomeButton
ft.hideHomeButton(Object object)
Hides the "Return to Home" button.
Parameters
Object object
| Property | Type | Default Value | Required | Description |
|---|---|---|---|---|
| success | function | No | Callback function for successful API call | |
| fail | function | No | Callback function for failed API call | |
| complete | function | No | Callback function for API call completion (executed regardless of success or failure) |
# Menu
# getMenuButtonBoundingClientRect
Supported since Base Library 1.3.9, iOS SDK 2.1.23, Android SDK 2.1.38
Gets the layout position information of the menu button (capsule button in the upper right corner). The coordinate system uses the top-left corner of the screen as the origin.
| Property | Type | Description |
|---|---|---|
| width | number | Width, in px |
| height | number | Height, in px |
| top | number | Top boundary coordinate, in px |
| right | number | Right boundary coordinate, in px |
| bottom | number | Bottom boundary coordinate, in px |
| left | number | Left boundary coordinate, in px |