我正在尝试使用Reactjs与kendo分割器。分割器具有类似于style属性的属性。
style="height: 100%"
使用Reactjs,如果我理解正确的话,可以使用内联样式来实现。
var style = {
height: 100
}
然而,我也在尝试使用 Dustin Getz 的 jsxutil 来将事物分开,使其更具独立性。到目前为止,我拥有以下的 HTML 片段(splitter.html)。
<div id="splitter" className="k-content">
<div id="vertical">
<div>
<p>Outer splitter : top pane (resizable and collapsible)</p>
</div>
<div id="middlePane">
{height}
<div id="horizontal" style={height}>
<div>
<p>Inner splitter :: left pane</p>
</div>
<div>
<p>Inner splitter :: center pane</p>
</div>
<div>
<p>Inner splitter :: right pane</p>
</div>
</div>
</div>
<div>
<p>Outer splitter : bottom pane (non-resizable, non-collapsible)</p>
</div>
还有一个 splitter.js 组件,它将引用此 HTML,如下所示:
define(['react', 'external/react/js/jsxutil','text!internal/html/splitter.html'],
function(React, jsxutil, splitterHtml) {
'use strict';
console.log('in app:' + splitterHtml);
return React.createClass({
render: function () {
var scope = {
height: 100
};
console.log('about to render:' + scope.height);
var dom = jsxutil.exec(splitterHtml, scope);
console.log('rendered:' + dom);
return dom;
}
});
}
)
现在当我运行这个程序时,如果将高度作为内容放置,我可以正确地看到它。然而,当它执行为样式属性时,我会收到一个错误。
The `style` prop expects a mapping from style properties to values, not a string.
所以显然我还没有正确地理解它。
如果有人能指导我如何纠正这个问题,我将非常感激。