mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 02:00:25 +08:00
fix: fix editable cells cannot be entered
This commit is contained in:
parent
beb4c3a37f
commit
4500214b2a
@ -43,7 +43,7 @@ const EditableCell = defineComponent({
|
|||||||
const elRef = ref<any>(null);
|
const elRef = ref<any>(null);
|
||||||
|
|
||||||
const isEditRef = ref(false);
|
const isEditRef = ref(false);
|
||||||
const currentValueRef = ref<string | boolean>('');
|
const currentValueRef = ref<string | boolean>(props.value);
|
||||||
|
|
||||||
function handleChange(e: ChangeEvent | string | boolean) {
|
function handleChange(e: ChangeEvent | string | boolean) {
|
||||||
if ((e as ChangeEvent).target && Reflect.has((e as ChangeEvent).target, 'value')) {
|
if ((e as ChangeEvent).target && Reflect.has((e as ChangeEvent).target, 'value')) {
|
||||||
@ -106,7 +106,7 @@ const EditableCell = defineComponent({
|
|||||||
}}
|
}}
|
||||||
style={{ width: 'calc(100% - 48px)' }}
|
style={{ width: 'calc(100% - 48px)' }}
|
||||||
ref={elRef}
|
ref={elRef}
|
||||||
value={value}
|
value={unref(currentValueRef)}
|
||||||
size="small"
|
size="small"
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onPressEnter={handleSubmit}
|
onPressEnter={handleSubmit}
|
||||||
@ -141,12 +141,12 @@ export function renderEditableCell({
|
|||||||
return ({ text, record }: { text: string; record: any }) => {
|
return ({ text, record }: { text: string; record: any }) => {
|
||||||
return (
|
return (
|
||||||
<EditableCell
|
<EditableCell
|
||||||
|
{...componentOn}
|
||||||
|
{...componentProps}
|
||||||
value={text}
|
value={text}
|
||||||
dataKey={record.key}
|
dataKey={record.key}
|
||||||
dataIndex={dataIndex}
|
dataIndex={dataIndex}
|
||||||
component={component}
|
component={component}
|
||||||
on={componentOn}
|
|
||||||
componentProps={componentProps}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="p-4">
|
<div ref="chartRef" :style="{ height, width }" />
|
||||||
<div ref="chartRef" :style="{ height, width }" />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
|
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
|
||||||
@ -18,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: String as PropType<string>,
|
type: String as PropType<string>,
|
||||||
default: '80vh',
|
default: 'calc(100vh - 78px)',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="p-4">
|
<div ref="chartRef" :style="{ height, width }" />
|
||||||
<div ref="chartRef" :style="{ height, width }" />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
|
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
|
||||||
@ -18,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: String as PropType<string>,
|
type: String as PropType<string>,
|
||||||
default: '80vh',
|
default: 'calc(100vh - 78px)',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="p-4">
|
<div ref="chartRef" :style="{ height, width }" />
|
||||||
<div ref="chartRef" :style="{ height, width }" />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
|
import { defineComponent, PropType, ref, Ref, onMounted } from 'vue';
|
||||||
@ -16,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: String as PropType<string>,
|
type: String as PropType<string>,
|
||||||
default: '80vh',
|
default: 'calc(100vh - 78px)',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
Loading…
Reference in New Issue
Block a user