# dialog
- [权限列表](#zh-cn_topic_0000001173324657_section11257113618419)
- [子组件](#zh-cn_topic_0000001173324657_section9288143101012)
- [属性](#zh-cn_topic_0000001173324657_section2907183951110)
- [样式](#zh-cn_topic_0000001173324657_section5775351116)
- [事件](#zh-cn_topic_0000001173324657_section8562129182916)
- [方法](#zh-cn_topic_0000001173324657_section11753103216253)
- [示例](#zh-cn_topic_0000001173324657_section6663311114620)
自定义弹窗容器。
## 权限列表
无
## 子组件
支持单个子组件。
## 属性
除支持[通用属性](js-components-common-attributes.md#ZH-CN_TOPIC_0000001163812208)外,支持如下属性:
名称
|
类型
|
默认值
|
必填
|
描述
|
dragable7+
|
boolean
|
false
|
否
|
设置对话框是否支持拖拽。
|
> **说明:**
>- 弹窗类组件不支持focusable、click-effect属性。
## 样式
仅支持[通用样式](js-components-common-styles.md#ZH-CN_TOPIC_0000001163932190)中的width、height、margin、margin-\[left|top|right|bottom\]、margin-\[start|end\]样式。
## 事件
不支持[通用事件](js-components-common-events.md#ZH-CN_TOPIC_0000001209412119),仅支持如下事件:
名称
|
参数
|
描述
|
cancel
|
-
|
用户点击非dialog区域触发取消弹窗时触发的事件。
|
show7+
|
-
|
对话框弹出时触发该事件。
|
close7+
|
-
|
对话框关闭时触发该事件。
|
## 方法
不支持[通用方法](js-components-common-methods.md#ZH-CN_TOPIC_0000001209252157),仅支持如下方法。
名称
|
参数
|
描述
|
show
|
-
|
弹出对话框。
|
close
|
-
|
关闭对话框。
|
> **说明:**
>dialog属性、样式均不支持动态更新。
## 示例
```
```
```
/* xxx.css */
.doc-page {
flex-direction: column;
justify-content: center;
align-items: center;
}
.btn-div {
width: 100%;
height: 200px;
flex-direction: column;
align-items: center;
justify-content: center;
}
.btn {
background-color: #F2F2F2;
text-color: #0D81F2;
}
.txt {
color: #000000;
font-weight: bold;
font-size: 39px;
}
.dialog-main {
width: 500px;
}
.dialog-div {
flex-direction: column;
align-items: center;
}
.inner-txt {
width: 400px;
height: 160px;
flex-direction: column;
align-items: center;
justify-content: space-around;
}
.inner-btn {
width: 400px;
height: 120px;
justify-content: space-around;
align-items: center;
}
.btn-txt {
background-color: #F2F2F2;
text-color: #0D81F2;
}
```
```
// xxx.js
import prompt from '@system.prompt';
export default {
showDialog(e) {
this.$element('simpledialog').show()
},
cancelDialog(e) {
prompt.showToast({
message: 'Dialog cancelled'
})
},
cancelSchedule(e) {
this.$element('simpledialog').close()
prompt.showToast({
message: 'Successfully cancelled'
})
},
setSchedule(e) {
this.$element('simpledialog').close()
prompt.showToast({
message: 'Successfully confirmed'
})
}
}
```
