fix: 修复双击编辑事件报错

This commit is contained in:
刘宗洋
2022-12-13 11:03:15 +08:00
parent 15f38491b2
commit dda600709b
2 changed files with 4 additions and 4 deletions

View File

@@ -124,7 +124,7 @@ export const staticRoutes: Array<RouteRecordRaw> = [
name: 'login', name: 'login',
component: () => import('@/views/login/index.vue'), component: () => import('@/views/login/index.vue'),
meta: { meta: {
title: '登', title: '登',
}, },
}, },
{ {

View File

@@ -1475,10 +1475,10 @@ const cellClick = (row: any, column: any, cell: any) => {
if (!state.nowTableName || !property) { if (!state.nowTableName || !property) {
return; return;
} }
let div: HTMLElement = cell.children[0];
if (div && div.tagName === 'DIV') {
// 转为字符串比较,可能存在数字等 // 转为字符串比较,可能存在数字等
let text = (row[property] || row[property] == 0 ? row[property] : '') + ''; let text = (row[property] || row[property] == 0 ? row[property] : '') + '';
let div: HTMLElement = cell.children[0];
if (div) {
let input = document.createElement('input'); let input = document.createElement('input');
input.setAttribute('value', text); input.setAttribute('value', text);
// 将表格width也赋值于输入框避免输入框长度超过表格长度 // 将表格width也赋值于输入框避免输入框长度超过表格长度