Skip to content

Commit 3e1a339

Browse files
committed
Update index.jsx
1 parent a84e406 commit 3e1a339

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

packages/ve-table/src/index.jsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,6 +2220,19 @@ export default {
22202220
},
22212221
};
22222222

2223+
// 直接在组件上写单元测试无法通过。如 on={{"on-node-click":()=>{}}}
2224+
const contextmenuProps = {
2225+
props: {
2226+
eventTarget: this.contextmenuEventTarget,
2227+
options: contextmenus,
2228+
},
2229+
on: {
2230+
"on-node-click": (type) => {
2231+
this.contextmenuCallBack(type);
2232+
},
2233+
},
2234+
};
2235+
22232236
return (
22242237
<VueDomResizeObserver {...wrapperContainerProps}>
22252238
<div {...containerProps}>
@@ -2239,15 +2252,7 @@ export default {
22392252
{/* edit input */}
22402253
{this.hasEditColumn && <EditInput {...editInputProps} />}
22412254
{/* contextmenu */}
2242-
{this.hasContextmenu && (
2243-
<VeContextmenu
2244-
eventTarget={this.contextmenuEventTarget}
2245-
options={contextmenus}
2246-
on={{
2247-
"on-node-click": this.contextmenuCallBack,
2248-
}}
2249-
/>
2250-
)}
2255+
{this.hasContextmenu && <VeContextmenu {...contextmenuProps} />}
22512256
</VueDomResizeObserver>
22522257
);
22532258
},

0 commit comments

Comments
 (0)