我正在尝试将 Reactjs 与剑道分离器一起使用。拆分器具有样式属性,例如
style="height: 100%"
使用 Reactjs,如果我理解正确的话,这可以使用内联样式来实现
var style = {
height: 100
}
但是,我也在使用 Dustin Getz jsxutil来尝试将事物进一步拆分并拥有独立的 html 片段。到目前为止,我有以下 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.
所以我显然还没有完全正确地映射它。
如果有人可以指导我纠正这个问题,我将不胜感激。