Skip to content

Commit

Permalink
Merge pull request #7 from xiyuesaves/main
Browse files Browse the repository at this point in the history
增加 setting-section 组件监听事件说明
  • Loading branch information
沫烬染 authored Feb 14, 2024
2 parents a5808fb + 45b7773 commit 62b0344
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/docs/web-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ LiteLoaderQQNT 使用 Web Components 封装了 QQNT 设置界面的一些组件
</setting-section>
```

下拉框可通过 `selected` 事件监听选项修改,示例:

``` html
<setting-select>
<setting-option data-value="1" is-selected>a</setting-option>
<setting-option data-value="2">b</setting-option>
<setting-option data-value="3">c</setting-option>
</setting-select>
```

``` javaScript
const settingSelectElement = document.addEventListener("setting-select");
settingSelectElement.addEventListener("selected", (event) => {
console.log(event); // {detail: {name: 'b', value: '2'}}
})
```

### setting-switch

开关按钮
Expand Down

0 comments on commit 62b0344

Please sign in to comment.