File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ export default defineComponent({
272
272
return ( ) => {
273
273
const renderNodeKey = props . renderNodeKey ?? slots . renderNodeKey ;
274
274
const renderNodeValue = props . renderNodeValue ?? slots . renderNodeValue ;
275
- const renderNodeActions = props . renderNodeActions || slots . renderNodeActions || false ;
275
+ const renderNodeActions = props . renderNodeActions ?? slots . renderNodeActions ?? false ;
276
276
277
277
const nodeContent =
278
278
state . visibleData &&
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export const treeNodePropsPass = {
49
49
type : [ Boolean , Function ] as PropType <
50
50
boolean | ( ( opt : { node : NodeDataType ; defaultActions : { copy : ( ) => void } } ) => unknown )
51
51
> ,
52
- default : false ,
52
+ default : undefined ,
53
53
} ,
54
54
// Define the selection method supported by the data level, which is not available by default.
55
55
selectableType : String as PropType < 'multiple' | 'single' | '' > ,
@@ -248,14 +248,13 @@ export default defineComponent({
248
248
249
249
const renderNodeActions = ( ) => {
250
250
const render = props . renderNodeActions ;
251
- if ( render === false ) return null ;
252
- else if ( render === true ) return < span onClick = { handleCopy } class = "vjs-tree-node-actions-item" > copy</ span > ;
251
+ if ( ! render ) return null ;
253
252
const defaultActions = {
254
253
copy : handleCopy ,
255
254
} ;
256
- return render
255
+ return typeof render === 'function'
257
256
? render ( { node : props . node , defaultActions } )
258
- : null ;
257
+ : < span onClick = { handleCopy } class = "vjs-tree-node-actions-item" > copy </ span > ;
259
258
} ;
260
259
261
260
return ( ) => {
@@ -352,7 +351,7 @@ export default defineComponent({
352
351
) }
353
352
</ span >
354
353
355
- { props . renderNodeActions !== false && (
354
+ { props . renderNodeActions && (
356
355
< span class = "vjs-tree-node-actions" >
357
356
{ renderNodeActions ( ) }
358
357
</ span >
You can’t perform that action at this time.
0 commit comments