点亮直到呈现函数源

  • 本文关键字:函数 typescript lit
  • 更新时间 :
  • 英文 :


我面临一个奇怪的问题,我使用lituntil等待一个承诺返回模板,但是until的函数代码被渲染,例如,我有

render() {
return html`
<div class="small-tool-card">
${this.renderProductLogo(product)}
<div class="text-container">
${this.renderProductTitle(product)}
${until(
this.renderTryLink(product),
html`
loading...
`
)}
</div>
</div>
`;
}

和"loading…"或者renderTryLink()的输出,它返回一个解析为html ' '的承诺,我看到下面的代码被渲染,

(part) => { let state = _state.get(part); if (state === undefined) { state = { lastRenderedIndex: _infinity, values: [], }; _state.set(part, state); } const previousValues

任何帮助都将不胜感激。谢谢。

change

import { until } from 'lit-html/directives/until.js';

import { until } from 'lit/directives/until.js';

解决这个问题。我相信通过从lit-html中导入,我们遗漏了其他指令。注意,lit的示例代码也需要修复。

最新更新