Skip to content

Commit

Permalink
update: doc
Browse files Browse the repository at this point in the history
  • Loading branch information
XboxYan committed Apr 7, 2023
1 parent 8e982fe commit ce6dd58
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
50 changes: 49 additions & 1 deletion docs/components/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import './index.css'

## dialog[method]

`xy-message`类似,`dialog`也提供了几个静态`API`方法,其实就是图标不同。
[message](./message)类似,`dialog`也提供了几个静态`API`方法,其实就是图标不同。

* `dialog.alert(config)`

Expand Down Expand Up @@ -204,6 +204,54 @@ dialog.loading = true;
dialog.setAttribute('loading',true);
```

## 自定义样式`::part(dialog)``::part(title)``::part(footer)`

由于内部结构比较多,这里暴露了弹窗、标题和页脚用来自定义样式

内部结构如下(可查看控制台):

```html
<xy-dialog>
# shadow-root
<dialog part="dialog">
<h4 part="title">
<slot></slot>
<slot name="footer" part="footer">
```

比如下面是一个标题和按钮居中的弹窗

<style scoped>
.custom-dialog::part(dialog){
width: 400px;
}
.custom-dialog::part(title){
text-align: center
}
.custom-dialog::part(footer){
justify-content: center
}
</style>

<xy-dialog class="custom-dialog" id="dialog03" title="标题" >
这是一个自定义样式的弹窗
</xy-dialog>
<div class="wrap">
<xy-button type="primary" onclick="document.getElementById('dialog03').open = true">自定义样式的弹窗</xy-button>
</div>

```css
xy-dialog::part(dialog){
width: 400px;
}
xy-dialog::part(title){
text-align: center
}
xy-dialog::part(footer){
justify-content: center
}
```

## 事件`event`

### onsubmit
Expand Down
2 changes: 1 addition & 1 deletion docs/components/popconfirm.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ popconfirm.setAttribute('title','确认要删除吗?');

由于内部结构比较多,这里仅暴露了标题和页脚用来自定义样式

内部结构如下(可查看控制台):
内部结构如下(可查看控制台):

```html
<xy-popconfirm>
Expand Down

0 comments on commit ce6dd58

Please sign in to comment.