mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-23 18:00:27 +08:00
chore(Calendar): inherit open/close events
This commit is contained in:
parent
e3a59afb07
commit
e2e34fd26e
@ -1,4 +1,5 @@
|
|||||||
// Utils
|
// Utils
|
||||||
|
import { pick } from '../utils';
|
||||||
import { isDate } from '../utils/validate/date';
|
import { isDate } from '../utils/validate/date';
|
||||||
import { getScrollTop } from '../utils/dom/scroll';
|
import { getScrollTop } from '../utils/dom/scroll';
|
||||||
import {
|
import {
|
||||||
@ -110,17 +111,7 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: [
|
emits: ['select', 'confirm', 'unselect', 'month-show', 'update:show'],
|
||||||
'open',
|
|
||||||
'close',
|
|
||||||
'opened',
|
|
||||||
'closed',
|
|
||||||
'select',
|
|
||||||
'confirm',
|
|
||||||
'unselect',
|
|
||||||
'month-show',
|
|
||||||
'update:show',
|
|
||||||
],
|
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
this.monthRefs = [];
|
this.monthRefs = [];
|
||||||
@ -401,19 +392,21 @@ export default createComponent({
|
|||||||
this.monthRefs[index] = val;
|
this.monthRefs[index] = val;
|
||||||
}}
|
}}
|
||||||
date={date}
|
date={date}
|
||||||
type={this.type}
|
|
||||||
color={this.color}
|
|
||||||
minDate={this.minDate}
|
|
||||||
maxDate={this.maxDate}
|
|
||||||
showMark={this.showMark}
|
|
||||||
formatter={this.formatter}
|
|
||||||
rowHeight={this.rowHeight}
|
|
||||||
lazyRender={this.lazyRender}
|
|
||||||
currentDate={this.currentDate}
|
|
||||||
showSubtitle={this.showSubtitle}
|
|
||||||
allowSameDay={this.allowSameDay}
|
|
||||||
showMonthTitle={showMonthTitle}
|
showMonthTitle={showMonthTitle}
|
||||||
firstDayOfWeek={this.dayOffset}
|
firstDayOfWeek={this.dayOffset}
|
||||||
|
{...pick(this, [
|
||||||
|
'type',
|
||||||
|
'color',
|
||||||
|
'minDate',
|
||||||
|
'maxDate',
|
||||||
|
'showMark',
|
||||||
|
'formatter',
|
||||||
|
'rowHeight',
|
||||||
|
'lazyRender',
|
||||||
|
'currentDate',
|
||||||
|
'showSubtitle',
|
||||||
|
'allowSameDay',
|
||||||
|
])}
|
||||||
onClick={this.onClickDay}
|
onClick={this.onClickDay}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -478,15 +471,6 @@ export default createComponent({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.poppable) {
|
if (this.poppable) {
|
||||||
const createListener = (name) => () => this.$emit(name);
|
|
||||||
const listeners = {
|
|
||||||
'onUpdate:show': this.togglePopup,
|
|
||||||
onOpen: createListener('open'),
|
|
||||||
onClose: createListener('close'),
|
|
||||||
onOpened: createListener('opened'),
|
|
||||||
onClosed: createListener('closed'),
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popup
|
<Popup
|
||||||
show={this.show}
|
show={this.show}
|
||||||
@ -497,7 +481,7 @@ export default createComponent({
|
|||||||
teleport={this.teleport}
|
teleport={this.teleport}
|
||||||
closeOnPopstate={this.closeOnPopstate}
|
closeOnPopstate={this.closeOnPopstate}
|
||||||
closeOnClickOverlay={this.closeOnClickOverlay}
|
closeOnClickOverlay={this.closeOnClickOverlay}
|
||||||
{...listeners}
|
{...{ 'onUpdate:show': this.togglePopup }}
|
||||||
>
|
>
|
||||||
{this.genCalendar()}
|
{this.genCalendar()}
|
||||||
</Popup>
|
</Popup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user