From e34fd25be1c5d16716af3bfc222c0c2081a4fc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=BD=E5=B0=8F=E6=A2=85?= <425605679@qq.com> Date: Wed, 13 Oct 2021 12:14:24 +0800 Subject: [PATCH] fix(tree): keep the default behavior keepace with layui --- .pnpm-debug.log | 23 ---------------- src/module/tree/TreeEntity.vue | 48 ++++++++++++++++++++-------------- src/module/tree/index.vue | 13 ++++++--- 3 files changed, 38 insertions(+), 46 deletions(-) delete mode 100644 .pnpm-debug.log diff --git a/.pnpm-debug.log b/.pnpm-debug.log deleted file mode 100644 index d2fa5a2e..00000000 --- a/.pnpm-debug.log +++ /dev/null @@ -1,23 +0,0 @@ -{ - "0 debug pnpm:scope": { - "selected": 1 - }, - "1 info pnpm": { - "err": { - "name": "Error", - "message": "not found: insta", - "code": "ENOENT", - "stack": "Error: not found: insta\n at getNotFoundError (D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:47811:51)\n at Function.whichSync [as sync] (D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:47888:13)\n at getCommandAbsolutePathSync (D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:49453:44)\n at Object.default_1 [as default] (D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:49462:32)\n at D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:129798:34" - } - }, - "2 error pnpm": { - "code": "ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL", - "prefix": "D:\\layui-vue", - "err": { - "name": "pnpm", - "message": "not found: insta", - "code": "ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL", - "stack": "Error: not found: insta\n at getNotFoundError (D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:47811:51)\n at Function.whichSync [as sync] (D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:47888:13)\n at getCommandAbsolutePathSync (D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:49453:44)\n at Object.default_1 [as default] (D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:49462:32)\n at D:\\service\\Nvm\\v16.6.2\\node_global\\node_modules\\pnpm\\dist\\pnpm.cjs:129798:34" - } - } -} \ No newline at end of file diff --git a/src/module/tree/TreeEntity.vue b/src/module/tree/TreeEntity.vue index e25eab30..082137d3 100644 --- a/src/module/tree/TreeEntity.vue +++ b/src/module/tree/TreeEntity.vue @@ -7,13 +7,14 @@ export default { import LayIcon from '../icon' import { TreeNode } from '/@src/module/tree/tree.type' +type EventType = 'icon' | 'node' + interface TreeEntityProps { node: TreeNode - onlyIconControl: boolean } interface EmitEvent { - (e: 'node-click', node: TreeNode): void + (e: 'node-click', node: TreeNode, type: EventType): void } const props = defineProps() @@ -44,19 +45,27 @@ const nodeIconType = (node: TreeNode): string => { } /** - * 发射至外层 + * Node Icon Click + * @param node + */ +function handleIconClick(node: TreeNode) { + emit('node-click', node, 'icon') +} + +/** + * Node Font Click * @param node */ function handleNodeClick(node: TreeNode) { - emit('node-click', node) + emit('node-click', node, 'node') } /** * 递归事件 * @param node */ -function innerClick(node: TreeNode) { - emit('node-click', node) +function innerClick(node: TreeNode, type: EventType) { + emit('node-click', node, type) }