# JSSDK
# 1. web-view Component
A container component for hosting web page content.
Starting from Base Library 3.6.4 and SDK 2.47.11, the cover-view component is supported within web-view pages.
If nesting is used inside web-view, due to underlying rendering layer reasons, the cover-view node under web-view must have a root node with fixed positioning added, for example:
<web-view src="https://some-url.com">
<cover-view style="position: fixed;top: 0;right: 0;width: 100vw;height: 100vh;">
...
</cover-view>
</web-view>
It can also be used in the following way; it is also recommended to add position: fixed to the cover-view as the root node to avoid layer issues:
<web-view src="https://some-url.com">
</web-view>
<cover-view style="position: fixed;top: 0;right: 0;width: 100vw;height: 100vh;">
...
</cover-view>
Attribute Description
| Attribute | Type | Default Value | Required | Description | Minimum Version |
|---|---|---|---|---|---|
| src | string | No | The web page link to open | ||
| timeout | number | 0 | Specifies the timeout event. If ft.complete() is not called by the web page within the specified time, the bindtimeout event will be triggered. | ||
| bindmessage | eventhandler | No | Triggered when the web page posts a message to the Mini-Program at specific times (Mini-Program navigation back, component destruction, sharing). e.detail = { data }, where data is an array of parameters from multiple postMessage calls. | ||
| bindload | eventhandler | No | Triggered when the web page loads successfully. e.detail = { src } | ||
| binderror | eventhandler | No | Triggered when the web page fails to load. e.detail = { src } | ||
| bindevent | eventhandler | No | Receives data sent by the web page via the JSSDK. | ||
| bindtimeout | eventhandler | No | Only takes effect when timeout is configured. Triggered when the web page loading times out or the web page does not call ft.complete. |
# 2. JSSDK Introduction
The JSSDK can be used within web-view web pages. By utilizing the JSSDK, web developers can efficiently access mobile system capabilities such as camera, image selection, voice, and location, while also directly leveraging the unique features of Mini-Programs to provide users with a superior web experience.
Since the JSSDK provides capabilities based on the web-view component within Mini-Programs, it can only be invoked when a domain link is opened using web-view within a Mini-Program. The links opened by web-view are controlled by an allowlist. Please configure the allowlist domain addresses in the Management Console under "Development Management > Domain Settings".
# 3. How to Use JSSDK in web-view
# 3.1 Importing via script Tag in the Web Page
<script src="path/to/jssdk.min.js">
JSSDK 1.4.20 (opens new window)
JSSDK 1.4.20(ESM) (opens new window)
# 3.2 Importing via npm
- Install
npm install finclip-js-sdk
- Usage
import ft from 'finclip-js-sdk'
ft.miniProgram.navigateTo({
url: '/pages/index/index'
})