@cicada/render
Advanced tools
Comparing version 1.1.8-alpha to 1.1.8-alpha1
@@ -69,3 +69,3 @@ 'use strict'; | ||
function getIdentifierProps(config) { | ||
function getIdentifierProps(config, key) { | ||
var _config$props = config.props, | ||
@@ -76,3 +76,3 @@ props = _config$props === undefined ? {} : _config$props, | ||
return (0, _assign2.default)(props, listeners ? { listeners: listeners } : {}, intercepters ? { intercepters: intercepters } : {}); | ||
return (0, _assign2.default)(props, { key: key }, listeners ? { listeners: listeners } : {}, intercepters ? { intercepters: intercepters } : {}); | ||
} | ||
@@ -91,3 +91,3 @@ | ||
// identifier 只要 config.props | ||
var props = type === _constant.COMPONENT_TYPE_IDENTIFIER ? getIdentifierProps(config) : | ||
var props = type === _constant.COMPONENT_TYPE_IDENTIFIER ? getIdentifierProps(config, createComponentKey()) : | ||
// 因为在 config 变化的情况下重用组件可能会导致位置问题,所以不如保证每个组件都是唯一的 | ||
@@ -94,0 +94,0 @@ (0, _extends3.default)({}, config, { path: componentPath, key: createComponentKey() }); |
@@ -27,2 +27,6 @@ 'use strict'; | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
var _extends3 = _interopRequireDefault(_extends2); | ||
var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
@@ -89,3 +93,3 @@ | ||
} | ||
return _react2.default.cloneElement(child, props); | ||
return _react2.default.cloneElement(child, (0, _extends3.default)({}, props, { key: path.join('.') })); | ||
}); | ||
@@ -173,7 +177,3 @@ } | ||
return this.props.config === undefined ? _react2.default.createElement( | ||
'div', | ||
null, | ||
patchPath(this.props.children) | ||
) : (0, _createFlatTree2.default)(this.components, undefined, this.props.config, undefined); | ||
return this.props.config === undefined ? patchPath(this.props.children) : (0, _createFlatTree2.default)(this.components, undefined, this.props.config, undefined); | ||
} | ||
@@ -180,0 +180,0 @@ }]); |
{ | ||
"name": "@cicada/render", | ||
"version": "1.1.8-alpha", | ||
"version": "1.1.8-alpha1", | ||
"main": "./lib/index.js", | ||
@@ -17,4 +17,4 @@ "scripts": { | ||
"peerDependencies": { | ||
"react": ">=16.0.0", | ||
"react-dom": ">=16.0.0" | ||
"react": ">=16.2.0", | ||
"react-dom": ">=16.2.0" | ||
}, | ||
@@ -21,0 +21,0 @@ "babel": { |
357452
8646