Dynamic prop/attr names
未关闭
discussion
proposal
- 主要语言
- JavaScript
- 星标
- 9k
- 派生
- 181
- PR 合并指标
- 30 天内没有已合并 PR
描述
Not the same as #109.
That would be useful to have insertable attribute names:
```js
html``
// same as
html``
```
## Practical cases
Optional attributes:
```js
html``
```
Private props:
```js
let html = htm.bind(h)
let _data = Symbol('data')
html``
function h (tag, props) {
props[_data]
}
```
Anonymous props:
```js
html``
function draggable(el) {
...
}
draggable[Symbol.toPrimitive] = () => 'data-draggable'
```
@developit @jviide would you consider that feature?
贡献指南
评估
这个 Issue 还没有评估数据。