Skip to content

Commit

Permalink
fix: fix editable cells cannot be entered
Browse files Browse the repository at this point in the history
  • Loading branch information
vben-admin committed Oct 12, 2020
1 parent beb4c3a commit 4500214
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/components/Table/src/components/renderEditableCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const EditableCell = defineComponent({
const elRef = ref<any>(null);

const isEditRef = ref(false);
const currentValueRef = ref<string | boolean>('');
const currentValueRef = ref<string | boolean>(props.value);

function handleChange(e: ChangeEvent | string | boolean) {
if ((e as ChangeEvent).target && Reflect.has((e as ChangeEvent).target, 'value')) {
Expand Down Expand Up @@ -106,7 +106,7 @@ const EditableCell = defineComponent({
}}
style={{ width: 'calc(100% - 48px)' }}
ref={elRef}
value={value}
value={unref(currentValueRef)}
size="small"
onChange={handleChange}
onPressEnter={handleSubmit}
Expand Down Expand Up @@ -141,12 +141,12 @@ export function renderEditableCell({
return ({ text, record }: { text: string; record: any }) => {
return (
<EditableCell
{...componentOn}
{...componentProps}
value={text}
dataKey={record.key}
dataIndex={dataIndex}
component={component}
on={componentOn}
componentProps={componentProps}
/>
);
};
Expand Down
6 changes: 2 additions & 4 deletions src/views/demo/echarts/Line.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<div class="p-4">
<div ref="chartRef" :style="{ height, width }" />
</div>
<div ref="chartRef" :style="{ height, width }" />
</template>
<script lang="ts">
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
Expand All @@ -18,7 +16,7 @@
},
height: {
type: String as PropType<string>,
default: '80vh',
default: 'calc(100vh - 78px)',
},
},
setup() {
Expand Down
6 changes: 2 additions & 4 deletions src/views/demo/echarts/Map.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<div class="p-4">
<div ref="chartRef" :style="{ height, width }" />
</div>
<div ref="chartRef" :style="{ height, width }" />
</template>
<script lang="ts">
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
Expand All @@ -18,7 +16,7 @@
},
height: {
type: String as PropType<string>,
default: '80vh',
default: 'calc(100vh - 78px)',
},
},
setup() {
Expand Down
6 changes: 2 additions & 4 deletions src/views/demo/echarts/Pie.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<div class="p-4">
<div ref="chartRef" :style="{ height, width }" />
</div>
<div ref="chartRef" :style="{ height, width }" />
</template>
<script lang="ts">
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
Expand All @@ -16,7 +14,7 @@
},
height: {
type: String as PropType<string>,
default: '80vh',
default: 'calc(100vh - 78px)',
},
},
setup() {
Expand Down

0 comments on commit 4500214

Please sign in to comment.