2016-12-20 13:48:39 +08:00
|
|
|
<template>
|
|
|
|
<div :class="[prefixCls + '-confirm']">
|
2016-12-30 17:00:26 +08:00
|
|
|
<span :class="timeClasses" v-if="showTime" @click="handleToggleTime">
|
2017-01-11 21:02:55 +08:00
|
|
|
<template v-if="isTime">{{ t('i.datepicker.selectDate') }}</template>
|
|
|
|
<template v-else>{{ t('i.datepicker.selectTime') }}</template>
|
2016-12-30 10:57:10 +08:00
|
|
|
</span>
|
2017-01-11 21:02:55 +08:00
|
|
|
<i-button size="small" type="text" @click="handleClear">{{ t('i.datepicker.clear') }}</i-button>
|
|
|
|
<i-button size="small" type="primary" @click="handleSuccess">{{ t('i.datepicker.ok') }}</i-button>
|
2016-12-20 13:48:39 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import iButton from '../../button/button.vue';
|
2017-01-11 21:02:55 +08:00
|
|
|
import Locale from '../../../mixins/locale';
|
2016-12-20 13:48:39 +08:00
|
|
|
|
|
|
|
const prefixCls = 'ivu-picker';
|
|
|
|
|
|
|
|
export default {
|
2017-01-11 21:02:55 +08:00
|
|
|
mixins: [ Locale ],
|
2016-12-20 13:48:39 +08:00
|
|
|
components: { iButton },
|
2016-12-30 10:57:10 +08:00
|
|
|
props: {
|
|
|
|
showTime: false,
|
2016-12-30 17:00:26 +08:00
|
|
|
isTime: false,
|
|
|
|
timeDisabled: false
|
2016-12-30 10:57:10 +08:00
|
|
|
},
|
2016-12-20 13:48:39 +08:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
prefixCls: prefixCls
|
2016-12-25 22:49:42 +08:00
|
|
|
};
|
2016-12-20 13:48:39 +08:00
|
|
|
},
|
2016-12-30 17:00:26 +08:00
|
|
|
computed: {
|
|
|
|
timeClasses () {
|
|
|
|
return {
|
|
|
|
[`${prefixCls}-confirm-time-disabled`]: this.timeDisabled
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
2016-12-20 13:48:39 +08:00
|
|
|
methods: {
|
|
|
|
handleClear () {
|
|
|
|
this.$emit('on-pick-clear');
|
|
|
|
},
|
|
|
|
handleSuccess () {
|
|
|
|
this.$emit('on-pick-success');
|
2016-12-30 10:57:10 +08:00
|
|
|
},
|
|
|
|
handleToggleTime () {
|
2016-12-30 17:00:26 +08:00
|
|
|
if (this.timeDisabled) return;
|
2016-12-30 10:57:10 +08:00
|
|
|
this.$emit('on-pick-toggle-time');
|
2016-12-20 13:48:39 +08:00
|
|
|
}
|
|
|
|
}
|
2016-12-25 22:49:42 +08:00
|
|
|
};
|
|
|
|
</script>
|