[英]How to integrate Material Ui with Meteor?
我正在尝试将 Material Ui 与 meteor 集成,并作为示例测试尝试执行以下但最终出现错误并且不知道如何解决它。 那里的任何人都可以帮助我解决此问题。 以下是一些需要跟踪的细节。
我是怎么安装的? --> meteor npm install @material-ui/core
我如何集成代码? 通过 Blaze React 组件
ExampleTest.js
Template.ExampleTest.helpers({
ExampleContainer() {
return ExampleContainer;
}
});
ExampleContainer.js
const ExampleContainer = withTracker(() => {
---------
})(Example);
Example.js
import React, { Component } from "react";
import { Button } from "@material-ui/core";
class Example extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<Button color="primary">Hello World</Button>
</div>
);
}
}
export default Example;
我收到了什么错误?
Error: In template "ExampleTest", call to `{{> React ... }}` missing `component` argument.
at Blaze.View.<anonymous> (react-template-helper.js?hash=3fb2a2954362a4acdee8150fb77f0f500dd28206:67)
at blaze.js?hash=cbd85c3fe14949f2d2b9a3b76334f5f0e96d553c:1934
at Function.Template._withTemplateInstanceFunc (blaze.js?hash=cbd85c3fe14949f2d2b9a3b76334f5f0e96d553c:3769)
at blaze.js?hash=cbd85c3fe14949f2d2b9a3b76334f5f0e96d553c:1932............
对此有任何帮助吗?
看起来您正在使用 Blaze 模板引擎。 你应该改用 React。 https://www.meteor.com/tutorials/react/components
Material UI 是一个用于 React 的 UI 框架。 它不适用于 Blaze,而且我认为没有任何方法可以在同一页面中同时使用 Blaze 和 React。
要将 Material UI 添加到 Meteor/React 项目,请从命令行安装 package:
npm install @material-ui/core
并在 HTML 的头部包含 Roboto 字体:
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
对我来说,这只是工作,Meteor 没有什么特别需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.