Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 ADatePicker 报错 #9

Open
kt3721 opened this issue Aug 20, 2021 · 2 comments
Open

使用 ADatePicker 报错 #9

kt3721 opened this issue Aug 20, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@kt3721
Copy link

kt3721 commented Aug 20, 2021

(必填)请填写问题描述或截图:
文档 配置如下:

vxe-cloumn 属性配置 editRender: { name: 'ADatePicker', props: { type: 'date', format: 'YYYY/MM/DD' } }

function getDatePickerCellValue (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.ExportMethodParams, defaultFormat: string) {
const { props = {} } = renderOpts
const { row, column } = params
let cellValue = XEUtils.get(row, column.property)
if (cellValue) {
cellValue = cellValue.format(props.format || defaultFormat)
}
return cellValue
}

传入值为 string 时,getDatePickerCellValuecellValue.format 报错

(必填)请填在线链接:
https://jsrun.net/dr8Kp/edit
在 控制台可 查看报错信息

(必填)请填写期望的结果:
正常使用 ADatePicker

(必填)请填写以下信息:

  • OS: Windows 10
  • Browser: Chrome 91.0.4472.164
  • vue: 3.2.2
  • vxe-table: 4.0.25
@kt3721 kt3721 added the bug Something isn't working label Aug 20, 2021
@contorlxys
Copy link

@kt3721 你解决没

@amikoj
Copy link

amikoj commented Oct 9, 2023

设置默认属性valueFormat可以解决:

ADatePicker: {
        renderEdit: createEditRender(),
        renderCell: formatDatePicker('YYYY-MM-DD'),
        renderItemContent: createFormItemRender({ valueFormat: 'YYYY-MM-DD' }), // 添加valueFormat,否则会自动绑定dayjs对象
        exportMethod: createDatePickerExportMethod('YYYY-MM-DD'),
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants