tusen-ai / naive-ui

A Vue 3 Component Library. Fairly Complete. Theme Customizable. Uses TypeScript. Fast.
https://www.naiveui.com
MIT License
15.53k stars 1.63k forks source link

n-tree组件node-props的onClick点击复选框没反应 #6029

Open xiaomaoJT opened 3 weeks ago

xiaomaoJT commented 3 weeks ago

Describe the bug

2.36.0版本正常,2.38.2版本点击复选框无反应,只有点击node才能激活onClick方法。

const nodeProps = ({ option }: { option: TreeOption }) => { return { onClick(e) { } } } }

Steps to reproduce

1、点击复选框 2、onClick方法无反应

Link to minimal reproduction

System Info

2.36.0为可用版本 
System:
    OS: macOS 13.6.4
    CPU: (8) arm64 Apple M1
    Memory: 65.67 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.8.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 124.0.6367.80
    Safari: 17.3
  npmPackages:
    naive-ui: 2.36.0 => 2.36.0
    vue: ^3.4.5 => 3.4.27

Used Package Manager

npm

Validations

jahnli commented 3 weeks ago

提供的复现 最小可复现的示例

xiaomaoJT commented 2 weeks ago

vue3+vite环境 <n-tree block-line block-node :show-line="true" selectable ref="treeRef" checkable :animated="false" expand-on-click check-on-click class="home-container-split-tree" default-expand-all :pattern="pattern" :data="treeData" :watch-props="['defaultCheckedKeys']" :default-checked-keys="defaultCheckedKeys" :node-props="nodeProps" />

const nodeProps = ({ option }: { option: TreeOption }) => { return { onClick(e) { //点击复选框无法触发 if (treeGetClickTarget(e) == 'checkbox') { checkedRowKeys.value = treeRef.value.getCheckedData().options } } } }