Templates
Interprets a template literal as an HTML template that can efficiently render to and update a container.
导入
签名
html(strings, values): TemplateResult
参数
- strings
TemplateStringsArray- values
Array<unknown>
A sentinel value that signals a NodePart to fully clear its content.
导入
类型
symbolRenders a template result or other value to a container.
导入
签名
render(result, container, options?): void
参数
- result
unknownAny value renderable by NodePart - typically a TemplateResult created by evaluating a template tag like
htmlorsvg.- container
Element | DocumentFragmentA DOM parent to render to. The entire contents are either replaced, or efficiently updated if the same result type was previous rendered there.
- options?
Partial<RenderOptions>RenderOptions for the entire render tree rendered to this container. Render options must not change between renders to the same container, as those changes will not effect previously rendered DOM.
详情
To update a container with new values, reevaluate the template literal and call render with the new result.
Interprets a template literal as an SVG template that can efficiently render to and update a container.
导入
签名
svg(strings, values): SVGTemplateResult
参数
- strings
TemplateStringsArray- values
Array<unknown>
A TemplateResult for SVG fragments.
导入
详情
This class wraps HTML in an <svg> tag in order to parse its contents in the SVG namespace, then modifies the template to remove the <svg> tag so that clones only container the original fragment.
方法和属性
new SVGTemplateResult(strings, values, type, processor): SVGTemplateResult
永久链接到 constructor参数
- strings
TemplateStringsArray- values
ReadonlyArray<unknown>- type
string- processor
TemplateProcessor
Returns a string of HTML used to create a <template> element.
The return type of html, which holds a Template and the values from interpolated expressions.
导入
方法和属性
参数
- strings
TemplateStringsArray- values
ReadonlyArray<unknown>- type
string- processor
TemplateProcessor
Returns a string of HTML used to create a <template> element.