hy-virtual-tree 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  _2026-03-11_
6
6
 
7
+ - 扩展[VirtualTree] 功能
8
+ (1)修复外部自定义插槽传入对象报错问题
9
+
10
+ ### 2.0.0
11
+
12
+ _2026-03-11_
13
+
7
14
  - 扩展[VirtualTree] 功能
8
15
  (1)新增 svg symbol 打包构建,替换 图标图片组件 为 svg组件
9
16
  (2)调整树组件的设备图标参数
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* hy-virtual-tree v2.0.0 */
1
+ /* hy-virtual-tree v2.0.1 */
2
2
  import './svg_bundle.js';
3
3
  const isString = (e) => typeof e === 'string';
4
4
  const isNumber = (e) => typeof e === 'number';
@@ -6708,8 +6708,8 @@ const setElementFocus = (config) => {
6708
6708
  const getElement = (vnode) => {
6709
6709
  return vnode.el;
6710
6710
  };
6711
- const createVNode = (tag, render) => {
6712
- const el = document.createElement(tag);
6711
+ const createVNode = (arg, render) => {
6712
+ const el = isString(arg) ? document.createElement(arg) : arg;
6713
6713
  let target = {
6714
6714
  el,
6715
6715
  children: [],
@@ -9020,6 +9020,12 @@ const customRender = (options) => {
9020
9020
  value = fn(node.data, node);
9021
9021
  }
9022
9022
  if (isObject(value) && value.el) {
9023
+ // 处理从外部传入的节点
9024
+ if (!value.mount) {
9025
+ value = createVNode(value.el, (vnode) => {
9026
+ vnode.$destroy = value.$destroy;
9027
+ });
9028
+ }
9023
9029
  className && value.el.classList.add(className);
9024
9030
  parent && value.mount(parent);
9025
9031
  return value;
@@ -9761,10 +9767,10 @@ class VirtualTree {
9761
9767
  rightSlot = customRender({ fn: config.renderRight, node: item, inset: true, className: 'hy-tree-node__right-content' });
9762
9768
  if (!statusSlot && !rightSlot)
9763
9769
  return;
9764
- return createVNode('div', (vnnode) => {
9765
- vnnode.el.classList.add('hy-tree-node__right');
9766
- statusSlot && statusSlot.mount(vnnode);
9767
- rightSlot && rightSlot.mount(vnnode);
9770
+ return createVNode('div', (vnode) => {
9771
+ vnode.el.classList.add('hy-tree-node__right');
9772
+ statusSlot && statusSlot.mount(vnode);
9773
+ rightSlot && rightSlot.mount(vnode);
9768
9774
  });
9769
9775
  };
9770
9776
  /** 设置节点class */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-virtual-tree",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",