<lynx-view><lynx-view> is a container component that loads and displays Lynx templates. It can be used in web applications to render Lynx templates.
After completing the above integration, you can achieve more flexible interaction control through the APIs provided by Lynx for Web. Here is a detailed description of the core APIs:
| Name | Required | Description |
|---|---|---|
| url | Yes | URL of the Rspeedy output (URLs of other chunks will be automatically injected and launched during compilation) |
| globalProps | No | GlobalProps for card initialization |
| initData | No | InitData for card initialization |
| overrideLynxTagToHTMLTagMap | No | Custom mapping relationship from Lynx tags to HTML tags. React Components are not supported, only HTMLElements (can be web components or native tags) |
Custom NativeModule where key is the module name and value is the module implementation (an ESM URL):
Example:
Entry point for handling NativeModules (JSB, etc.) related calls:
Example:
Allows users to implement custom template loading functionality (default is fetch):
Error message notification:
The internal layout of lynx-view will be forced out of the external layout flow
We will force all lynx-view elements to apply CSS Containment.
That is, by default, you need to set a width and height for lynx-view. The width and height can be allocated by flex-grow or specified as a percentage, but cannot be "stretched". Setting width and height is a strongly recommended practice and also a best practice for performance.
In some cases where you really need the width or height to be determined by the content of lynx-view, you can set height="auto" or width="auto" to enable the automatic width/height listener. In this case, the internal layout of lynx-view remains independent of the external layout flow.
The recommended configuration is: Chrome > 118, Safari > 18, Firefox NSR
If you want to support browsers with Chrome < 118 and Safari < 18, you need to do the following:
@lynx-js dependencies. If your project uses Rsbuild, modify the configuration as follows:Uncaught SecurityError: Failed to construct 'Worker': Script at 'xxx' cannot be accessed from origin 'xxx'.This is because Worker loading remote scripts needs to comply with the Same-Origin Policy, and the JS resources of the project are generally deployed on CDN, causing cross-origin issues.
This can be solved by introducing remote-web-worker:
We provide an RSBuild plugin for performance optimization. You can introduce this plugin in your web project.
LCD tables only load in the browser