mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
style(Dialog): fix round-button theme (#6934)
* style(Dialog): fix round-button theme * style(Dialog): improve round-button theme
This commit is contained in:
parent
f82177abcc
commit
d342fa3781
@ -12,11 +12,8 @@ export default createComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
title: String,
|
title: String,
|
||||||
|
theme: String,
|
||||||
width: [Number, String],
|
width: [Number, String],
|
||||||
theme: {
|
|
||||||
type: String,
|
|
||||||
default: 'default',
|
|
||||||
},
|
|
||||||
message: String,
|
message: String,
|
||||||
className: null,
|
className: null,
|
||||||
callback: Function,
|
callback: Function,
|
||||||
@ -108,14 +105,15 @@ export default createComponent({
|
|||||||
|
|
||||||
genRoundButtons() {
|
genRoundButtons() {
|
||||||
return (
|
return (
|
||||||
<GoodsAction class={bem('footer', [this.theme])}>
|
<GoodsAction class={bem('footer')}>
|
||||||
{this.showCancelButton && (
|
{this.showCancelButton && (
|
||||||
<GoodsActionButton
|
<GoodsActionButton
|
||||||
size="large"
|
size="large"
|
||||||
type="warning"
|
type="warning"
|
||||||
loading={this.loading.cancel}
|
|
||||||
text={this.cancelButtonText || t('cancel')}
|
text={this.cancelButtonText || t('cancel')}
|
||||||
style={{ color: this.cancelButtonColor }}
|
class={bem('cancel')}
|
||||||
|
color={this.cancelButtonColor}
|
||||||
|
loading={this.loading.cancel}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.handleAction('cancel');
|
this.handleAction('cancel');
|
||||||
}}
|
}}
|
||||||
@ -125,9 +123,10 @@ export default createComponent({
|
|||||||
<GoodsActionButton
|
<GoodsActionButton
|
||||||
size="large"
|
size="large"
|
||||||
type="danger"
|
type="danger"
|
||||||
loading={this.loading.confirm}
|
|
||||||
text={this.confirmButtonText || t('confirm')}
|
text={this.confirmButtonText || t('confirm')}
|
||||||
style={{ color: this.confirmButtonColor }}
|
class={bem('confirm')}
|
||||||
|
color={this.confirmButtonColor}
|
||||||
|
loading={this.loading.confirm}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.handleAction('confirm');
|
this.handleAction('confirm');
|
||||||
}}
|
}}
|
||||||
@ -141,7 +140,7 @@ export default createComponent({
|
|||||||
const multiple = this.showCancelButton && this.showConfirmButton;
|
const multiple = this.showCancelButton && this.showConfirmButton;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={[BORDER_TOP, bem('footer', { buttons: multiple })]}>
|
<div class={[BORDER_TOP, bem('footer')]}>
|
||||||
{this.showCancelButton && (
|
{this.showCancelButton && (
|
||||||
<Button
|
<Button
|
||||||
size="large"
|
size="large"
|
||||||
@ -220,7 +219,7 @@ export default createComponent({
|
|||||||
vShow={this.value}
|
vShow={this.value}
|
||||||
role="dialog"
|
role="dialog"
|
||||||
aria-labelledby={this.title || message}
|
aria-labelledby={this.title || message}
|
||||||
class={[bem(), this.className]}
|
class={[bem([this.theme]), this.className]}
|
||||||
style={{ width: addUnit(this.width) }}
|
style={{ width: addUnit(this.width) }}
|
||||||
>
|
>
|
||||||
{Title}
|
{Title}
|
||||||
|
@ -52,18 +52,18 @@ export default {
|
|||||||
'zh-CN': {
|
'zh-CN': {
|
||||||
alert1: '提示弹窗',
|
alert1: '提示弹窗',
|
||||||
alert2: '提示弹窗(无标题)',
|
alert2: '提示弹窗(无标题)',
|
||||||
round: '圆角按钮样式',
|
|
||||||
confirm: '确认弹窗',
|
confirm: '确认弹窗',
|
||||||
asyncClose: '异步关闭',
|
asyncClose: '异步关闭',
|
||||||
|
roundButton: '圆角按钮样式',
|
||||||
componentCall: '组件调用',
|
componentCall: '组件调用',
|
||||||
content: '代码是写出来给人看的,附带能在机器上运行',
|
content: '代码是写出来给人看的,附带能在机器上运行',
|
||||||
},
|
},
|
||||||
'en-US': {
|
'en-US': {
|
||||||
alert1: 'Alert',
|
alert1: 'Alert',
|
||||||
alert2: 'Alert without title',
|
alert2: 'Alert without title',
|
||||||
round: 'Round Button Style',
|
|
||||||
confirm: 'Confirm dialog',
|
confirm: 'Confirm dialog',
|
||||||
asyncClose: 'Async Close',
|
asyncClose: 'Async Close',
|
||||||
|
roundButton: 'Round Button Style',
|
||||||
componentCall: 'Component Call',
|
componentCall: 'Component Call',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -48,12 +48,12 @@ Dialog.defaultOptions = {
|
|||||||
value: true,
|
value: true,
|
||||||
title: '',
|
title: '',
|
||||||
width: '',
|
width: '',
|
||||||
|
theme: null,
|
||||||
message: '',
|
message: '',
|
||||||
overlay: true,
|
overlay: true,
|
||||||
className: '',
|
className: '',
|
||||||
allowHtml: true,
|
allowHtml: true,
|
||||||
lockScroll: true,
|
lockScroll: true,
|
||||||
theme: 'default',
|
|
||||||
transition: 'van-dialog-bounce',
|
transition: 'van-dialog-bounce',
|
||||||
beforeClose: null,
|
beforeClose: null,
|
||||||
overlayClass: '',
|
overlayClass: '',
|
||||||
|
@ -57,25 +57,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&__footer {
|
&__footer {
|
||||||
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
&&--round {
|
|
||||||
position: relative;
|
|
||||||
height: auto;
|
|
||||||
padding: 0 @padding-lg - 5px @padding-md;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&--buttons {
|
&__confirm,
|
||||||
display: flex;
|
&__cancel {
|
||||||
|
|
||||||
.van-button {
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
margin: 0;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.van-button {
|
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +76,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--round-button {
|
||||||
|
.van-dialog__footer {
|
||||||
|
position: relative;
|
||||||
|
height: auto;
|
||||||
|
padding: 0 @padding-lg @padding-md;
|
||||||
|
}
|
||||||
|
|
||||||
|
.van-dialog__message {
|
||||||
|
color: @text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.van-dialog__confirm {
|
||||||
|
color: @white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-bounce-enter {
|
&-bounce-enter {
|
||||||
transform: translate3d(-50%, -50%, 0) scale(0.7);
|
transform: translate3d(-50%, -50%, 0) scale(0.7);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
@ -38,7 +38,7 @@ exports[`renders demo correctly 1`] = `
|
|||||||
<div role="dialog" aria-labelledby="标题" class="van-dialog" style="display: none;" name="van-dialog-bounce">
|
<div role="dialog" aria-labelledby="标题" class="van-dialog" style="display: none;" name="van-dialog-bounce">
|
||||||
<div class="van-dialog__header">标题</div>
|
<div class="van-dialog__header">标题</div>
|
||||||
<div class="van-dialog__content"><img src="https://img.yzcdn.cn/vant/apple-3.jpg"></div>
|
<div class="van-dialog__content"><img src="https://img.yzcdn.cn/vant/apple-3.jpg"></div>
|
||||||
<div class="van-hairline--top van-dialog__footer van-dialog__footer--buttons"><button class="van-button van-button--default van-button--large van-dialog__cancel">
|
<div class="van-hairline--top van-dialog__footer"><button class="van-button van-button--default van-button--large van-dialog__cancel">
|
||||||
<div class="van-button__content"><span class="van-button__text">取消</span></div>
|
<div class="van-button__content"><span class="van-button__text">取消</span></div>
|
||||||
</button><button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left">
|
</button><button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left">
|
||||||
<div class="van-button__content"><span class="van-button__text">确认弹窗</span></div>
|
<div class="van-button__content"><span class="van-button__text">确认弹窗</span></div>
|
||||||
|
@ -4,7 +4,7 @@ exports[`allow-html prop 1`] = `<div class="van-dialog__message"><span>tex
|
|||||||
|
|
||||||
exports[`button color 1`] = `
|
exports[`button color 1`] = `
|
||||||
<div role="dialog" class="van-dialog" name="van-dialog-bounce">
|
<div role="dialog" class="van-dialog" name="van-dialog-bounce">
|
||||||
<div class="van-hairline--top van-dialog__footer van-dialog__footer--buttons"><button class="van-button van-button--default van-button--large van-dialog__cancel" style="color: white;">
|
<div class="van-hairline--top van-dialog__footer"><button class="van-button van-button--default van-button--large van-dialog__cancel" style="color: white;">
|
||||||
<div class="van-button__content"><span class="van-button__text">取消</span></div>
|
<div class="van-button__content"><span class="van-button__text">取消</span></div>
|
||||||
</button><button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left" style="color: red;">
|
</button><button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left" style="color: red;">
|
||||||
<div class="van-button__content"><span class="van-button__text">确认</span></div>
|
<div class="van-button__content"><span class="van-button__text">确认</span></div>
|
||||||
@ -14,7 +14,7 @@ exports[`button color 1`] = `
|
|||||||
|
|
||||||
exports[`button text 1`] = `
|
exports[`button text 1`] = `
|
||||||
<div role="dialog" class="van-dialog" name="van-dialog-bounce">
|
<div role="dialog" class="van-dialog" name="van-dialog-bounce">
|
||||||
<div class="van-hairline--top van-dialog__footer van-dialog__footer--buttons"><button class="van-button van-button--default van-button--large van-dialog__cancel">
|
<div class="van-hairline--top van-dialog__footer"><button class="van-button van-button--default van-button--large van-dialog__cancel">
|
||||||
<div class="van-button__content"><span class="van-button__text">Custom cancel</span></div>
|
<div class="van-button__content"><span class="van-button__text">Custom cancel</span></div>
|
||||||
</button><button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left">
|
</button><button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left">
|
||||||
<div class="van-button__content"><span class="van-button__text">Custom confirm</span></div>
|
<div class="van-button__content"><span class="van-button__text">Custom confirm</span></div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user