mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
dialog fix
This commit is contained in:
parent
9255184f26
commit
1ab44ea055
@ -25,6 +25,14 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleAlert2Click() {
|
||||||
|
Dialog.alert({
|
||||||
|
message: '无标题alert'
|
||||||
|
}).then((action) => {
|
||||||
|
console.log(action);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
handleConfirmClick() {
|
handleConfirmClick() {
|
||||||
Dialog.confirm({
|
Dialog.confirm({
|
||||||
title: 'confirm标题',
|
title: 'confirm标题',
|
||||||
@ -58,6 +66,7 @@ import { Dialog } from '@youzan/zanui-vue';
|
|||||||
:::demo 消息提示
|
:::demo 消息提示
|
||||||
```html
|
```html
|
||||||
<zan-button @click="handleAlertClick">alert</zan-button>
|
<zan-button @click="handleAlertClick">alert</zan-button>
|
||||||
|
<zan-button @click="handleAlert2Click">无标题alert</zan-button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
@ -69,6 +78,14 @@ export default {
|
|||||||
}).then((action) => {
|
}).then((action) => {
|
||||||
console.log(action);
|
console.log(action);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleAlert2Click() {
|
||||||
|
Dialog.alert({
|
||||||
|
message: '弹窗提示文字,左右始终距离边20PX,上下距离20PX,文字左对齐。弹窗提示文字,左右始终距离边20PX,上下距离20PX,文字左对齐。'
|
||||||
|
}).then((action) => {
|
||||||
|
console.log(action);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -76,6 +76,8 @@ var DialogBox = options => {
|
|||||||
DialogBox.alert = function(options) {
|
DialogBox.alert = function(options) {
|
||||||
return DialogBox(merge({
|
return DialogBox(merge({
|
||||||
type: 'alert',
|
type: 'alert',
|
||||||
|
title: '',
|
||||||
|
message: '',
|
||||||
closeOnClickOverlay: false,
|
closeOnClickOverlay: false,
|
||||||
showCancelButton: false
|
showCancelButton: false
|
||||||
}, options));
|
}, options));
|
||||||
@ -84,6 +86,8 @@ DialogBox.alert = function(options) {
|
|||||||
DialogBox.confirm = function(options) {
|
DialogBox.confirm = function(options) {
|
||||||
return DialogBox(merge({
|
return DialogBox(merge({
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
|
title: '',
|
||||||
|
message: '',
|
||||||
closeOnClickOverlay: true,
|
closeOnClickOverlay: true,
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
}, options));
|
}, options));
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="zan-dialog__title" v-text="title"></div>
|
<div class="zan-dialog__title" v-text="title"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="zan-dialog__content" v-if="message">
|
<div class="zan-dialog__content" v-if="message">
|
||||||
<div class="zan-dialog__message" v-html="message"></div>
|
<div class="zan-dialog__message" :class="{ 'zan-dialog__message--notitle': !title }" v-html="message"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="zan-dialog__footer" :class="{ 'is-twobtn': showCancelButton && showConfirmButton }">
|
<div class="zan-dialog__footer" :class="{ 'is-twobtn': showCancelButton && showConfirmButton }">
|
||||||
<button class="zan-dialog__btn zan-dialog__cancel" v-show="showCancelButton" @click="handleAction('cancel')">{{ cancelButtonText }}</button>
|
<button class="zan-dialog__btn zan-dialog__cancel" v-show="showCancelButton" @click="handleAction('cancel')">{{ cancelButtonText }}</button>
|
||||||
|
@ -56,12 +56,7 @@ export default {
|
|||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: ''
|
||||||
validator(value) {
|
|
||||||
if (this.type === 'success' || this.type === 'fail') {
|
|
||||||
return value.length <= 16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
forbidClick: {
|
forbidClick: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -46,6 +46,11 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
|
||||||
|
@m notitle {
|
||||||
|
color: #333;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@e footer {
|
@e footer {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user