Эх сурвалжийг харах

公式说明-勾选框clearFormula属性读不到问题

duy 1 долоо хоног өмнө
parent
commit
ed417befcb

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20251204155017"
+  "value": "20251204184830"
 }

+ 17 - 1
src/global/components/table-form/index.vue

@@ -217,9 +217,25 @@ const onRightClick = async (pkeyId, event, KeyName, pid) => {
     }
 }
 
+// 深度优先查找第一个带有 clearFormula 属性的节点
+function getClearFormula(el) {
+  if (!el) return null
+
+  const val = el.getAttribute?.('clearFormula')
+  if (val != null) return val
+
+  const children = el.children || []
+  for (let i = 0; i < children.length; i++) {
+    const childVal = getClearFormula(children[i])
+    if (childVal != null) return childVal
+  }
+  return null
+}
+
 const setShiftTableForm = async (key, pid, pkeyId, event) => {
     const dom = event.target
-    const clearFormula = dom.getAttribute('clearFormula') || null
+    const clearFormula = getClearFormula(dom)
+
     emit('focusTap', { clearFormula, key, pkeyId })
 
     if (isCtrlKey.value) {