tools/api/docs/templates/load-template.mdx
{{ api.brief_desc }}
{% if api.android_member %}
{{ api.android_member.prototype }}
{% if api.android_member.params %}
{% for param in api.android_member.params %}
{{ param.name }}: {{ param.brief_desc }}
{% endfor %}
{% endif %}
{% if api.android_member.returns.brief_desc %}:::note
{% for note in api.android_member.note %}
::: {% endif %} {% endif %} {% if api.ios_member %}
{{ api.ios_member.prototype }}
{% if api.ios_member.params %}
{% for param in api.ios_member.params %}
{{ param.name }}: {{ param.brief_desc }}
{% endfor %}
{% endif %}
{% if api.ios_member.returns.brief_desc %}:::note
{% for note in api.ios_member.note %}
::: {% endif %} {% endif %}
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:
@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%' })
}
}
import { LegacyCompatTable } from '@lynx';
<LegacyCompatTable metadata="lynx-native-api/{{ api.parent_name }}/{{ api.kebab_name }}" />