Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Mar 21, 2021
1 parent 25ece23 commit 7f6fc7f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
31 changes: 23 additions & 8 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ function getItemProps (renderOpts: VxeGlobalRendererHandles.RenderOptions, param
return XEUtils.assign({}, defaultProps, renderOpts.props, { [getModelProp(renderOpts)]: value })
}

function formatText (cellValue: any) {
return '' + (isEmptyValue(cellValue) ? '' : cellValue)
}

function getCellLabelVNs (renderOpts: VxeColumnPropTypes.EditRender, params: VxeGlobalRendererHandles.RenderCellParams, cellLabel: any) {
const { placeholder } = renderOpts
return [
h('span', {
class: 'vxe-cell--label'
}, isEmptyValue(cellLabel) ? [
h('span', {
class: 'vxe-cell--placeholder'
}, formatText(placeholder))
] : formatText(cellLabel))
]
}

function getOns (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderParams, inputFunc?: Function, changeFunc?: Function) {
const { events } = renderOpts
const modelEvent = getModelEvent(renderOpts)
Expand Down Expand Up @@ -183,7 +200,7 @@ function getSelectCellValue (renderOpts: VxeColumnPropTypes.EditRender, params:
}
return selectlabel
}
return null
return ''
}

function getCascaderCellValue (renderOpts: VxeGlobalRendererHandles.RenderOptions, params: VxeGlobalRendererHandles.RenderCellParams) {
Expand Down Expand Up @@ -339,7 +356,7 @@ function renderOptions (options: any[], optionProps: VxeGlobalRendererHandles.Re
}

function cellText (cellValue: any): string[] {
return ['' + (isEmptyValue(cellValue) ? '' : cellValue)]
return [formatText(cellValue)]
}

function createFormItemRender (defaultProps?: { [key: string]: any }) {
Expand Down Expand Up @@ -530,7 +547,7 @@ export const VXETablePluginElement = {
]
},
renderCell (renderOpts, params) {
return cellText(getSelectCellValue(renderOpts, params))
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params))
},
renderFilter (renderOpts, params) {
const { options = [], optionGroups, optionProps = {}, optionGroupProps = {} } = renderOpts
Expand Down Expand Up @@ -642,15 +659,15 @@ export const VXETablePluginElement = {
ElCascader: {
renderEdit: createEditRender(),
renderCell (renderOpts, params) {
return cellText(getCascaderCellValue(renderOpts, params))
return getCellLabelVNs(renderOpts, params, getCascaderCellValue(renderOpts, params))
},
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getCascaderCellValue)
},
ElDatePicker: {
renderEdit: createEditRender(),
renderCell (renderOpts, params) {
return cellText(getDatePickerCellValue(renderOpts, params))
return getCellLabelVNs(renderOpts, params, getDatePickerCellValue(renderOpts, params))
},
renderFilter (renderOpts, params) {
const { column } = params
Expand Down Expand Up @@ -698,9 +715,7 @@ export const VXETablePluginElement = {
ElTimePicker: {
renderEdit: createEditRender(),
renderCell (renderOpts, params) {
return [
getTimePickerCellValue(renderOpts, params)
]
return getCellLabelVNs(renderOpts, params, getTimePickerCellValue(renderOpts, params))
},
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getTimePickerCellValue)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-table-plugin-element",
"version": "3.0.1",
"version": "3.0.2",
"description": "基于 vxe-table 表格的适配插件,用于兼容 element-ui 组件库",
"scripts": {
"lib": "gulp build"
Expand Down Expand Up @@ -50,7 +50,7 @@
"prettier": "^2.1.2",
"typescript": "^4.0.5",
"vue": "^3.0.6",
"vxe-table": "^4.0.3",
"vxe-table": "^4.0.5",
"xe-utils": "^3.1.11"
},
"peerDependencies": {
Expand Down

0 comments on commit 7f6fc7f

Please sign in to comment.