所以我想在我的发光组件中有一个加载指示器,直到它加载。这是 HTML:
<login-element class=" flex justify-center items-center">
<div class="animate-spin rounded-full h-11 w-11 border-t-2 border-b-2 border-purple-500"></div>
</login-element>
这是打字稿代码:
import {LitElement, html} from 'lit';
import {customElement} from 'lit/decorators.js';
@customElement('login-element')
export class LoginElement extends LitElement {
override createRenderRoot(){ return this; }
override render() {
return html`<a href="/auth0" class="inline-block text-sm px-4 py-2 leading-none border rounded text-white border-white hover:border-transparent hover:text-teal-500 hover:bg-white mt-4 lg:mt-0">Sign In</a>`
}
}
目前,它附加了登录按钮。我希望它取代加载指示器。有推荐的方法吗?