-
Notifications
You must be signed in to change notification settings - Fork 284
Expand file tree
/
Copy pathtime-picker-panel.tsx
More file actions
42 lines (39 loc) · 1.51 KB
/
time-picker-panel.tsx
File metadata and controls
42 lines (39 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { defineComponent, getCurrentInstance } from 'vue';
import type { SetupContext } from 'vue';
import { useNamespace } from '@devui/shared/utils';
import DTimeList from '../../../time-picker/src/components/popup-line';
import useTimePickerPanel from '../composables/use-time-picker-panel';
import { TimerPickerPanelProps, timerPickerPanelProps } from '../date-picker-pro-types';
import { createI18nTranslate } from '../../../locale/create';
export default defineComponent({
name: 'TimerPickerPanel',
props: timerPickerPanelProps,
emits: ['selectedTime'],
setup(props: TimerPickerPanelProps, ctx: SetupContext) {
const app = getCurrentInstance();
const t = createI18nTranslate('DDatePickerPro', app);
const ns = useNamespace('date-picker-pro');
const { timeListDom, hourList, minuteList, secondList, handlerTimeSelected } = useTimePickerPanel(props, ctx);
return () => {
return (
<div class={ns.e('panel-time')}>
<div class={ns.em('panel-time', 'title')}>
{t('getTimeArr')().map((child: string) => (
<span class={ns.em('panel-time', 'title-item')}> {child}</span>
))}
</div>
<div class={ns.em('panel-time', 'content')}>
<DTimeList
ref={timeListDom}
hourList={hourList}
minuteList={minuteList}
secondList={secondList}
itemHeight={30}
onChange={handlerTimeSelected}
/>
</div>
</div>
);
};
},
});