2

我想要一些关于一个奇怪问题的建议。我创建了一个最小的 Meteor 应用程序

meteor create testreactmeteordata  
cd testreactmeteordata  
meteor add react kadira:react-layout kadira:flow-router  
rm testreactmeteordata.*

并添加了以下 main.jsx 文件:

if (Meteor.isClient) {
    App = React.createClass({
        mixins: [ReactMeteorData],
        render() {
            return (
                <div>
                    <h1>App</h1>
                </div>
            )
        }
    });
}

FlowRouter.route('/', {
    name: 'Dashboard',
    action() {
        ReactLayout.render(App);
    }
});

这不会渲染任何东西,除非mixins:行被删除!?

这是这个小项目中使用的版本:

$ meteor list
autopublish           1.0.4  (For prototyping only) Publish the entire databa...
blaze-html-templates  1.0.1  Compile HTML templates into reactive UI with Met...
ecmascript            0.1.6* Compiler plugin that supports ES2015+ in all .js...
es5-shim              4.1.14  Shims and polyfills to improve ECMAScript 5 sup...
insecure              1.0.4  (For prototyping only) Allow all database writes...
jquery                1.11.4  Manipulate the DOM using CSS selectors
kadira:flow-router    2.10.0  Carefully Designed Client Side Router for Meteor
kadira:react-layout   1.5.3  Layout Manager for React with SSR Support
meteor-base           1.0.1  Packages that every Meteor app needs
mobile-experience     1.0.1  Packages for a great mobile user experience
mongo                 1.1.3  Adaptor for using MongoDB and Minimongo over DDP
react                 0.14.3* Everything you need to use React with Meteor.
session               1.1.1  Session variable
standard-minifiers    1.0.2  Standard minifiers used with Meteor apps by defa...
tracker               1.0.9  Dependency tracker to allow reactive callbacks


* New versions of these packages are available! Run 'meteor update' to try to
  update those packages to their latest versions. If your packages cannot be
  updated further, try typing `meteor add <package>@<newVersion>` to see more
  information.

更新流星并没有真正帮助:

2016-01-19 16:41 ~/src/meteor/testreactmeteordata
$ meteor update
This project is already at Meteor 1.2.1, the latest release.
Your top-level dependencies are at their latest compatible versions.

The following top-level dependencies were not updated to the very latest
version available:
 * react 0.14.3 (0.14.3_1 is available)

Newer versions of the following indirect dependencies are available:
 * jsx 0.2.3 (0.2.4 is available)
 * react-meteor-data 0.2.4 (0.2.5 is available)
To update one or more of these packages, pass their names to `meteor update`.

尝试按照建议手动升级反应显示了一堆冲突:

2016-01-19 16:42 ~/src/meteor/testreactmeteordata
$ meteor add react@0.14.3_1
 => Errors while adding packages:

While selecting package versions:
error: Conflict: Constraint ecmascript@0.3.0 is not satisfied by ecmascript
0.1.6.
Constraints on package "ecmascript":
* ecmascript@=0.1.6 <- top level
* ecmascript@0.1.6 <- random 1.0.5 <- autoupdate 1.2.4 <- hot-code-push 1.0.0
<- meteor-base 1.0.1
* ecmascript@0.1.6 <- random 1.0.5 <- minimongo 1.0.10 <- mongo 1.1.3
* ecmascript@0.1.6 <- random 1.0.5 <- mongo 1.1.3
* ecmascript@0.1.6 <- ddp-server 1.2.2 <- ddp 1.2.2 <- autoupdate 1.2.4 <-
hot-code-push 1.0.0 <- meteor-base 1.0.1
* ecmascript@0.1.6 <- ddp-server 1.2.2 <- ddp 1.2.2 <- livedata 1.0.15 <-
meteor-base 1.0.1
* ecmascript@0.1.6 <- ddp-server 1.2.2 <- ddp 1.2.2 <- meteor-base 1.0.1
* ecmascript@0.1.6 <- templating 1.1.5 <- blaze-html-templates 1.0.1
* ecmascript@0.1.5 <- caching-html-compiler 1.0.2 <- templating 1.1.5 <-
blaze-html-templates 1.0.1
* ecmascript@0.1.3 <- caching-compiler 1.0.0 <- caching-html-compiler 1.0.2 <-
templating 1.1.5 <- blaze-html-templates 1.0.1
* ecmascript@0.1.3 <- caching-compiler 1.0.0 <- cosmos:browserify 0.9.3 <-
kadira:flow-router 2.10.0
* ecmascript@0.1.3 <- templating-tools 1.0.0 <- caching-html-compiler 1.0.2 <-
templating 1.1.5 <- blaze-html-templates 1.0.1
* ecmascript@0.1.3 <- templating-tools 1.0.0 <- templating 1.1.5 <-
blaze-html-templates 1.0.1
* ecmascript@0.1.6 <- reactive-dict 1.1.3 <- kadira:flow-router 2.10.0
* ecmascript@0.3.0 <- jsx 0.2.4 <- react 0.14.3_1
* ecmascript@0.1.6 <- coffeescript 1.0.11 <- cosmos:browserify 0.9.3 <-
kadira:flow-router 2.10.0

请指教。

TIA,

圭多

4

1 回答 1

4

您需要getMeteorDataReactComponent. 想像mixins一个接口。当你在类中使用时,这意味着你的类正在实现它,因此需要一个实现

于 2016-01-19T19:06:49.600 回答