视图层

Meteor官方提供了三种不同的用户界面(UI)渲染库,包括BlazeReactAngular。当Meteor于2011年发布时,Blaze作为Meteor的一部分被创建,React则由Facebook于2013年创建,Angular被谷歌创建于2010年。它们都被成功的应用于大规模的应用生产环境中。Blaze是其中简单易学以及最全栈化得Meteor包,但是React和Angular被更广泛的应用于开发中并有着巨大的社区基础。

Syntax

  • Blaze uses an easy-to-learn Handlebars-like template syntax, with logic like {{#if}} and {{#each}} interspersed in your HTML files. Template functions and CSS-selector events maps are written in JavaScript files.
  • React uses JSX, with which you write your HTML in JavaScript. While it doesn't have the logic-view separation most libraries have, it also has the most flexibility. Template functions and event handlers are defined in the same file as the HTML part of the component, which usually makes it easier to understand how they are tied together.
  • Angular uses HTML with special attribute syntax for logic and events. Template helpers are written in the accompanying JavaScript file along with events, which are called by name from inside HTML attributes.
  • React and Angular enforce a better component structure, which makes developing larger apps easier. (Although you can add component structure to Blaze by following conventions or using the Blaze Components or ViewModel packages.)

Community

  • Blaze has many full-stack Meteor packages on Atmosphere, such as useraccounts:core and aldeed:autoform.
  • React has 41k stars on Github and 13k npm libraries.
  • Angular has 11k stars on Github and 4k npm libraries.

Performance

  • Render performance varies a lot depending on the situation. All three libraries are very quick at rendering simple apps, but can take a noticeable amount of time with more complex apps.
  • Angular and React have had more performance optimization work put into them than Blaze and in general will perform better. However, there are some cases when Blaze does better (for instance an {{#each}} over a changing cursor).
  • One test benchmarks Angular 2 as the best, followed by React and Angular 1, followed by Blaze.

Mobile

  • Cordova
    • All three libraries work fine in a Cordova web view, and you can use mobile CSS libraries like Ionic's CSS with any view library.
    • The most advanced mobile web framework is Ionic 2, which uses Angular 2.
    • Ionic 1 uses Angular 1, but there are also Blaze and React ports.
    • If you're using React, the most popular mobile web React framework is Reapp.
  • Native
    • You can connect any native iOS or Android app to a Meteor server via DDP. For iOS, use the meteor-ios framework.
    • You can write native clients in JavaScript using React Native. For the most recent information on how to use React Native with Meteor, see this reference.

results matching ""

    No results matching ""