Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
来自反应背景,我想知道在 lit-element 中 state 和 setState 在哪里等效,我在 lit-element 文档中找不到任何有用的东西。是私有财产吗?还是requestUpdate?
requestUpdate
LitElement中没有state,至少不是直接的。
state
您所拥有的是您在getterproperties中定义的一组。static get properties()
properties
static get properties()
它们的行为或多或少类似于staterect 中的行为,每次其中一个properties更改时,元素都会更新。