mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-26 00:19:14 +08:00
[new feature] Dialog: add message-align prop (#1067)
This commit is contained in:
parent
9eedd9776d
commit
2ca2ced432
@ -39,6 +39,7 @@ Dialog.alert({
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### 消息确认
|
#### 消息确认
|
||||||
|
|
||||||
用于确认消息,包含取消和确认按钮
|
用于确认消息,包含取消和确认按钮
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@ -127,6 +128,7 @@ Page({
|
|||||||
|-----------|-----------|-----------|-------------|
|
|-----------|-----------|-----------|-------------|
|
||||||
| title | 标题 | `String` | - |
|
| title | 标题 | `String` | - |
|
||||||
| message | 内容 | `String` | - |
|
| message | 内容 | `String` | - |
|
||||||
|
| messageAlign | 内容对齐方式,可选值为`left` `right` | `String` | `center` |
|
||||||
| zIndex | z-index 层级 | `Number` | `100` |
|
| zIndex | z-index 层级 | `Number` | `100` |
|
||||||
| selector | 自定义选择器 | `String` | `van-dialog` |
|
| selector | 自定义选择器 | `String` | `van-dialog` |
|
||||||
| showConfirmButton | 是否展示确认按钮 | `Boolean` | `true` |
|
| showConfirmButton | 是否展示确认按钮 | `Boolean` | `true` |
|
||||||
@ -149,6 +151,7 @@ Page({
|
|||||||
| show | 是否显示弹窗 | `Boolean` | - |
|
| show | 是否显示弹窗 | `Boolean` | - |
|
||||||
| title | 标题 | `String` | - |
|
| title | 标题 | `String` | - |
|
||||||
| message | 内容 | `String` | - |
|
| message | 内容 | `String` | - |
|
||||||
|
| message-align | 内容对齐方式,可选值为`left` `right` | `String` | `center` |
|
||||||
| z-index | z-index 层级 | `Number` | `100` |
|
| z-index | z-index 层级 | `Number` | `100` |
|
||||||
| show-confirm-button | 是否展示确认按钮 | `Boolean` | `true` |
|
| show-confirm-button | 是否展示确认按钮 | `Boolean` | `true` |
|
||||||
| show-cancel-button | 是否展示取消按钮 | `Boolean` | `false` |
|
| show-cancel-button | 是否展示取消按钮 | `Boolean` | `false` |
|
||||||
|
@ -11,6 +11,7 @@ type DialogOptions = {
|
|||||||
selector?: string;
|
selector?: string;
|
||||||
transition?: string;
|
transition?: string;
|
||||||
asyncClose?: boolean;
|
asyncClose?: boolean;
|
||||||
|
messageAlign?: string;
|
||||||
confirmButtonText?: string;
|
confirmButtonText?: string;
|
||||||
cancelButtonText?: string;
|
cancelButtonText?: string;
|
||||||
showConfirmButton?: boolean;
|
showConfirmButton?: boolean;
|
||||||
@ -68,6 +69,7 @@ Dialog.defaultOptions = {
|
|||||||
zIndex: 100,
|
zIndex: 100,
|
||||||
overlay: true,
|
overlay: true,
|
||||||
asyncClose: false,
|
asyncClose: false,
|
||||||
|
messageAlign: '',
|
||||||
transition: 'scale',
|
transition: 'scale',
|
||||||
selector: '#van-dialog',
|
selector: '#van-dialog',
|
||||||
confirmButtonText: '确认',
|
confirmButtonText: '确认',
|
||||||
|
@ -23,12 +23,21 @@
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
max-height: 60vh;
|
max-height: 60vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
text-align: center;
|
||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
|
|
||||||
&--has-title {
|
&--has-title {
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
color: @gray-darker;
|
color: @gray-darker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--left {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__footer {
|
&__footer {
|
||||||
|
@ -10,6 +10,7 @@ VantComponent({
|
|||||||
message: String,
|
message: String,
|
||||||
useSlot: Boolean,
|
useSlot: Boolean,
|
||||||
asyncClose: Boolean,
|
asyncClose: Boolean,
|
||||||
|
messageAlign: String,
|
||||||
showCancelButton: Boolean,
|
showCancelButton: Boolean,
|
||||||
closeOnClickOverlay: Boolean,
|
closeOnClickOverlay: Boolean,
|
||||||
confirmButtonOpenType: String,
|
confirmButtonOpenType: String,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<slot wx:if="{{ useSlot }}" />
|
<slot wx:if="{{ useSlot }}" />
|
||||||
<view
|
<view
|
||||||
wx:elif="{{ message }}"
|
wx:elif="{{ message }}"
|
||||||
class="van-dialog__message {{ title ? 'van-dialog__message--has-title' : '' }}"
|
class="van-dialog__message {{ title ? 'van-dialog__message--has-title' : '' }} {{ messageAlign ? 'van-dialog__message--' + messageAlign : '' }}"
|
||||||
>
|
>
|
||||||
<text>{{ message }}</text>
|
<text>{{ message }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user