我已经安装了ngReact,并且我能够使用本文:https://www.logilab.org/blogentry/7366955在我的Range1.3项目中创建一个基本组件(Hello )
但我不知道如何在我的角度应用中使用。一个组件的名称是什么?有人做过这个吗?我欢迎你来个小小的指导!谢谢!
发布于 2017-01-18 12:27:26
仅仅通过阅读你的文章,你就需要做一些事情。
您需要将react作为脚本导入,您可以检查它们的实现方式,在这里。
在此之后,ReactDataGrid组件将对您可用,您可以对链接中的示例执行相同的操作。如果您不使用jsx,那么如果您查看一下在这里,情况会更好。您的最终代码如下所示
// define a React component that displays "Hello {name}"
var GridComponent = React.createClass({
render: function() {
var props = { x: this.props.x, y: this.props.y ...};
// you can filter the props or just inject this.props
return React.createElement(ReactDataGrid, props, null);
}
});要使用该功能,只需创建如下所示的网格控制器:
<div ng-app="app" ng-controller="helloController">
<react-component name="GridElement" props="yourProps" />
</div>https://stackoverflow.com/questions/41707657
复制相似问题