模块化前段UI制作 - component 看来很不错 by TJ
 发布于 11 年前  作者 leapon  6315 次预览  最后一次回复是 11 年前  来自  
5 回复
leapon

一个简单的例子在这里:

http://tjholowaychuk.tumblr.com/post/37832588021/building-a-date-picker-component

我跟着做了一下,有点问题,找不到依赖的库。不过 github 上的代码好用。

https://github.com/component/datepicker

jiyinyiyong

昨天还试了一次, 教程太差了, 我都搞不清楚怎么用… 不过模块真心多…

leapon

昨天试了一个进展条的component

http://blog.kewah.com/2014/build-a-web-app-with-component/

也是出错。命令行的结果和blog里的不太一样。东西比较新,更新太快。

Component(1) is a front-end package manager created by TJ Holowaychuk. It embraces the philosophy of creating small and reusable modules. It is not restricted to JavaScript, indeed we are able to create components that also contain CSS, HTML, JSON, images, fonts, … Therefore we can create JavaScript libraries, UI component or reusable CSS utility classes. It allows us to organize applications around multiple components.

leapon

进展条例子中读template有问题,改成内置字符串可暂时解决出错问题:

//var template = require('./template.html');
var template =
    '<div class="progressBar">' + 
    '<div class="progressBar-percent js-percentBar"></div>' + 
    '</div>';
kiddkai

可以用 browserify + component + brfs