From fa6e0bc231a1b1599f82664b516f809679e96efc Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 10 Jul 2021 17:32:14 +0800 Subject: [PATCH] add --- src/core/4.widget.js | 4 ++++ src/core/element2Snabbdom.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/core/4.widget.js b/src/core/4.widget.js index e3ea3a012..bba3c5baa 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -29,6 +29,7 @@ tagName: "div", attributes: null, data: null, + key: null, tag: null, disabled: false, @@ -135,6 +136,9 @@ if (o._baseCls || o.baseCls || o.extraCls || o.cls) { this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || "")); } + if (o.key != null) { + this.element.attr("key", o.key); + } if (o.attributes) { this.element.attr(o.attributes); } diff --git a/src/core/element2Snabbdom.js b/src/core/element2Snabbdom.js index 90af92cdc..2d063df6e 100644 --- a/src/core/element2Snabbdom.js +++ b/src/core/element2Snabbdom.js @@ -15,12 +15,14 @@ }; }); var style = parentNode.getAttribute("style"); + var key = parentNode.getAttribute("key"); // var claz = parentNode.getAttribute("class"); var vnode = BI.Snabbdom.h(parentNode.nodeName, { class: BI.makeObject(parentNode.classList), props: { style: style }, + key: key, on: on, hook: { create: function () {