API List
API List
| Method Name | Description |
|---|---|
| start | Initialize the LI PASS Web Component |
| unmount | Uninstall/Disable the LI PASS Web Component |
| changeLanguage | To switch languages, see the Language List for supported languages. |
| on | Listen for events; see the Event List for supported events. |
| bind | How to Link LI PASS |
unmount
Calling the unmount method will remove the LI PASS Web component from the DOM.
changeLanguage
You can switch the component language by calling the changeLanguage method; if the input language parameter is not supported, the default language en will be displayed.
Example
// Component switches language to Italian\npass.changeLanguage("it");
Language List
| Code | Language Type |
|---|---|
| ar | Arabic |
| cs | Czech |
| de | German |
| en | English |
| es | Spanish (Latin America) |
| es-eu | Spanish (Europe) |
| fi | Finnish |
| fil-PH | Filipino |
| fr | French |
| hi | Hindi |
| id | Indonesian |
| it | Italian |
| ja | Japanese |
| ko | Korean |
| ms | Malay |
| nl | Dutch |
| pl | Polish |
| pt | Portuguese (Latin America) |
| ru | Russian |
| th | Thai |
| tr | Turkish |
| vi | Vietnamese |
| zh-Hant | Chinese (Traditional) |
| zh-Hans | Chinese (Simplified) |
| zh-TW | Chinese (Taiwan) |
on
The on method provided by the pass component can register callback event handlers.When the user performs operations on the LI PASS Web component, the component will call back at the appropriate times.
note
Ensure to register the event before the user triggers the corresponding event.
Example
pass.on("onLogin", (userInfo) => {\n // After the user fails to log in, the 'onLoginError event' is triggered, and the business logic after successful login can be processed in this event callback\n // such as redirecting to a specific page\n console.log(userInfo);\n});\n\npass.on("onLoginError", (userInfo) => {\n // After the user successfully logs in, the 'onLogin event' is triggered, and the business logic after failed login can be processed in this event callback\n console.log(userInfo);\n});\n\npass.on("onRegister", (userInfo) => {\n // Logic added after successful registration\n // such as redirecting to a specific page\n console.log(userInfo);\n});
Event List
| Method Name | Description | Callback Parameters |
|---|---|---|
| onLoad | Load and render component | accountApi |
| onClose | Close the component by clicking the close button in modal mode | accountApi |
| onLogin | Login Successful | error, accountApi |
| onLoginError | Login failed | error |
| onLoginTabChange | Tab Switch on the Component | activeTab |
| onRegister | Registered successfully | error, accountApi |
| onRegisterError | Registration failed | error |
| onPwdReset | Password reset successful | accountApi |
| onPwdResetError | Password reset failed | error, accountApi |
bind
See binding for details.