vant/packages/dialog/dialog.vue
neverland d8b6ad7d54
[new feature] add i18n support (#310)
* fix: Tabbar icon line-height

* [new feature] progress add showPivot prop

* [new feature] TabItem support vue-router

* [new feature] update document header style

* [Doc] add toast english ducoment

* [new feature] add i18n support

* feat: Extract demos from markdown

* feat: Base components demos

* [new feature] complete demo extract & translate

* [fix] text cases

* fix: add deepAssign test cases

* fix: changelog detail

* [new feature] AddressEdit support i18n
2017-11-15 20:08:51 -06:00

88 lines
2.0 KiB
Vue

<template>
<transition name="van-dialog-bounce">
<div class="van-dialog" v-show="value">
<div class="van-dialog__header" v-if="title" v-text="title" />
<div class="van-dialog__content van-hairline">
<slot>
<div class="van-dialog__message" v-if="message" :class="{ 'van-dialog__message--withtitle': title }" v-html="message" />
</slot>
</div>
<div class="van-dialog__footer" :class="{ 'is-twobtn': showCancelButton && showConfirmButton }">
<van-button
size="large"
class="van-dialog__cancel"
v-show="showCancelButton"
@click="handleAction('cancel')"
>
{{ cancelButtonText || $t('cancel') }}
</van-button>
<van-button
size="large"
:class="['van-dialog__confirm', { 'van-hairline--left': showCancelButton && showConfirmButton }]"
v-show="showConfirmButton"
@click="handleAction('confirm')"
>
{{ confirmButtonText || $t('confirm') }}
</van-button>
</div>
</div>
</transition>
</template>
<script>
import Button from '../button';
import Popup from '../mixins/popup';
import { i18n } from '../locale';
export default {
name: 'van-dialog',
components: {
[Button.name]: Button
},
mixins: [Popup, i18n],
props: {
confirmButtonText: String,
cancelButtonText: String,
title: {
type: String,
default: ''
},
message: {
type: String,
default: ''
},
showConfirmButton: {
type: Boolean,
default: true
},
showCancelButton: {
type: Boolean,
default: false
},
callback: {
type: Function
},
overlay: {
default: true
},
closeOnClickOverlay: {
default: false
},
lockOnScroll: {
default: true
}
},
methods: {
handleAction(action) {
this.$emit('input', false);
this.$emit(action);
this.callback && this.callback(action);
}
}
};
</script>