fezui
Version:
FEZUI 是一套基于 Vue 的支持多终端的开源UI交互组件库,致力于积木式的快速构建项目,提升产品体验和开发效率、降低开发和维护成本。
36 lines (33 loc) • 874 B
JavaScript
import Picker from '../picker.vue';
import TimePanel from '../panel/time.vue';
import TimeRangePanel from '../panel/time-range.vue';
import Options from '../time-mixins';
const getPanel = function (type) {
if (type === 'timerange') {
return TimeRangePanel;
}
return TimePanel;
};
import { oneOf } from '../../../utils/assist';
export default {
mixins: [Picker, Options],
props: {
type: {
validator (value) {
return oneOf(value, ['time', 'timerange']);
},
default: 'time'
},
value: {}
},
created () {
if (!this.currentValue) {
if (this.type === 'timerange') {
this.currentValue = ['',''];
} else {
this.currentValue = '';
}
}
this.panel = getPanel(this.type);
}
};