值= $ {; hello} and .value = $ {; hello; hello;
我正在阅读点亮文档,并发现: https://lit.dev /docs/templates/expressions/#property-expressions
html`<input .value=${this.itemCount}>`;
测试:我在“ value”单词之前删除了点,没有任何更改。
为什么我需要添加这个点?
I'm reading the Lit docs, and found that: https://lit.dev/docs/templates/expressions/#property-expressions
html`<input .value=${this.itemCount}>`;
Testing: I removed the dot before "value" word and nothing changed.
Why I need to add this dot ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该点使其成为属性,另一个是属性。
属性仅插入字符串。这意味着,如果您传递对象,功能或数组,则将这些对象,功能或数组转换为字符串,然后在接收组件中再次转换回。这可能会变得非常昂贵。
使用属性,您的对象,函数和数组不会被解析,这就是为什么属性(
.myproperty
)更快的原因。The dot makes it a property, and the other is an attribute.
Attributes only takes in strings. That means if you pass an object, function or array, these will be converted to strings, and then converted back again in the receiving component. This can become quite expensive.
Using properties, your objects, functions and arrays are not parsed, which is why properties (
.myProperty
) are faster.