hookehuyr

临时处理日期选择控件format问题

......@@ -102,6 +102,25 @@ VantComponent({
if (defaultFormatter) {
formatter = defaultFormatter;
}
// 默认写死配置
formatter = (type, value) => {
if (type === 'year') {
return `${value}年`;
}
if (type === 'month') {
return `${value}月`;
}
if (type === 'day') {
return `${value}日`;
}
if (type === 'hour') {
return `${value}时`;
}
if (type === 'minute') {
return `${value}分`;
}
return value;
}
const results = this.getOriginColumns().map((column) => ({
values: column.values.map((value) => formatter(column.type, value)),
}));
......@@ -266,7 +285,26 @@ VantComponent({
updateColumnValue(value) {
let values = [];
const { type } = this.data;
const formatter = this.data.formatter || defaultFormatter;
let formatter = this.data.formatter || defaultFormatter;
// 默认写死配置
formatter = (type, value) => {
if (type === 'year') {
return `${value}年`;
}
if (type === 'month') {
return `${value}月`;
}
if (type === 'day') {
return `${value}日`;
}
if (type === 'hour') {
return `${value}时`;
}
if (type === 'minute') {
return `${value}分`;
}
return value;
}
const picker = this.getPicker();
if (type === 'time') {
const pair = value.split(':');
......