带有 HTML 元素属性/属性的 LitElement 点 [英] LitElement Dot with HTML elements attribute/property

查看:22
本文介绍了带有 HTML 元素属性/属性的 LitElement 点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Polymer 学习 Web 组件.我是网络开发的初学者.

I am learning web components using Polymer. I am a beginner in web development.

如何理解 HTML 元素的 .checked 属性或属性中的点符号是什么意思?

How can I understand what does dot notation means in .checked attributes or property of HTML element?

<input id="state" type="radio" name=${this.group} .checked=${this.checked} />

推荐答案

总的来说,绑定类型由以下字符前缀组成:.prop?optional@event.

Overall the binding type consists of these character prefixes: .prop, ?optional and @event.

html`<input 
    id="state" 
    type="radio" 
    name=${this.group} 
    @change=${onChange}
    ?required=${required}
    .checked=${this.checked} />`

您可以插入 JavaScript 表达式作为 HTML 文本内容、属性、布尔属性、属性和事件处理程序的占位符.

You can insert JavaScript expressions as placeholders for HTML text content, attributes, Boolean attributes, properties, and event handlers.

  • 文本内容:<p>${...}</p>
  • 属性:<p id="${...}"></p>
  • 布尔属性:?disabled="${...}"
  • 属性:.value=${...}"
  • 事件处理程序:@event=${...}"

lit-element 文档

现场演示

这篇关于带有 HTML 元素属性/属性的 LitElement 点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆