From 7784e87511aaaed77058fcef6d9a313da4f51244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 1 Jan 2018 01:20:51 +0800 Subject: [PATCH] =?UTF-8?q?tree=E7=BB=84=E4=BB=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=A4=9A=E9=80=89=E5=BC=80=E5=85=B3;=E4=BC=98=E5=8C=96:attr?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/anot.shim.js | 12 +++++++++--- src/js/tree/index.js | 15 ++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/js/anot.shim.js b/src/js/anot.shim.js index 0d97598..554f4af 100644 --- a/src/js/anot.shim.js +++ b/src/js/anot.shim.js @@ -3723,16 +3723,22 @@ if (!W3C && propMap[k]) { k = propMap[k] } + if (obj[i] === false || obj[i] === null || obj[i] === undefined) { + obj[i] = '' + } if (typeof elem[boolMap[k]] === 'boolean') { //布尔属性必须使用el.xxx = true|false方式设值 elem[boolMap[k]] = !!obj[i] //如果为false, IE全系列下相当于setAttribute(xxx, ''),会影响到样式,需要进一步处理 - if (!obj[i]) obj[i] = !!obj[i] + if (!obj[i]) { + obj[i] = !!obj[i] + } + if (obj[i] === false) { + return elem.removeAttribute(k) + } } - if (obj[i] === false || obj[i] === null || obj[i] === undefined) - return elem.removeAttribute(k) //SVG只能使用setAttribute(xxx, yyy), VML只能使用elem.xxx = yyy ,HTML的固有属性必须elem.xxx = yyy var isInnate = rsvg.test(elem) diff --git a/src/js/tree/index.js b/src/js/tree/index.js index bb651d4..8792e04 100644 --- a/src/js/tree/index.js +++ b/src/js/tree/index.js @@ -44,6 +44,7 @@ export default Anot.component('tree', { @@ -72,8 +74,10 @@ export default Anot.component('tree', { props.parent = props.parent || 'parent' props.children = props.children || 'children' state.list = format(props.list || [], props) + state.multiCheck = !!props.multiCheck delete props.list delete props.theme + delete props.multiCheck }, componentDidMount: function() { if (typeof this.props.onCreated === 'function') { @@ -82,16 +86,17 @@ export default Anot.component('tree', { }, state: { list: [], + multiCheck: false, currItem: -1, checked: {} }, skip: ['checked'], props: { className: '', - id: 'id', - label: 'label', - parent: 'parent', - children: 'children', + id: '', + label: '', + parent: '', + children: '', onCreated: Anot.PropsTypes.isFunction(), onSelected: Anot.PropsTypes.isFunction(), onChecked: Anot.PropsTypes.isFunction()