Back to Lynx

{{ api.name }}

tools/api/docs/templates/load-template.mdx

3.7.02.3 KB
Original Source

{{ api.name }}

{{ api.brief_desc }}

Syntax

{% if api.android_member %}

Android

java
{{ api.android_member.prototype }}

{% if api.android_member.params %}

Parameters

{% for param in api.android_member.params %}

  • {{ param.name }}: {{ param.brief_desc }} {% endfor %} {% endif %} {% if api.android_member.returns.brief_desc %}

Return

  • {{ api.android_member.returns.brief_desc }} {% endif %} {% if api.android_member.note %}

:::note

{% for note in api.android_member.note %}

  • {{ note }} {% endfor %}

::: {% endif %} {% endif %} {% if api.ios_member %}

iOS

objc
{{ api.ios_member.prototype }}

{% if api.ios_member.params %}

Parameters

{% for param in api.ios_member.params %}

  • {{ param.name }}: {{ param.brief_desc }} {% endfor %} {% endif %} {% if api.ios_member.returns.brief_desc %}

Return

  • {{ api.ios_member.returns.brief_desc }} {% endif %} {% if api.ios_member.note %}

:::note

{% for note in api.ios_member.note %}

  • {{ note }} {% endfor %}

::: {% endif %} {% endif %}

Harmony

LynxView has the following members:

  • url: String : Template file path.
  • buffer: ArrayBuffer: The binary file data of the template.
  • templateBundle: TemplateBundle: TemplateBundle object parsed in advance by the template's binary file data.
  • metaData: MetaData: Initial data specified by the client during the first screen loading process.
  • loadOption: LynxLoadOption: Additional configuration information when loading templates.

On the HarmonyOS platfrom, you need to pass your implemented LynxViewClient as a parameter during the initialization of LynxView:

typescript
@Entry
@Component
struct Index {
  private url: string = 'playground/main.lynx.bundle';
  private buffer: ArrayBuffer = getTemplateBuffer();
  private metaData = new MetaData(
    new TemplateData('{"text":"TD"}'),
    new TemplateData({ "theme": "Light" }));

  build() {
    Column() {
      LynxView({
        url: this.url,
        buffer: this.buffer,
        metadata: this.metaData,
      }).width('100%').height('100%');
    }
    .size({ width: '100%', height: '100%' })
  }
}

Compatibility

import { LegacyCompatTable } from '@lynx';

<LegacyCompatTable metadata="lynx-native-api/{{ api.parent_name }}/{{ api.kebab_name }}" />