我有关于redux和同构应用的3个一般问题:
提前致谢.
我想知道为什么当我在类中使用 Typescript 中的装饰器或注释时。编译器无法推断该类的新类型。如果我不使用装饰器并使用 ES5 中的旧方法来执行此操作(即手动调用装饰器),它显然可以工作。
例如,这里有一个显示问题的示例:
function decorate(Target: typeof Base): IExtendedBaseConstructor {
return class extends Target implements IExtendedBase {
public extendedtMethod(): number {
return 3;
}
};
}
interface IBase {
baseMethod(): number;
}
interface IExtendedBase extends Base {
extendedtMethod(): number;
}
interface IExtendedBaseConstructor {
new(): IExtendedBase;
}
@decorate
class Base implements IBase {
public baseMethod(): number {
return 5;
}
}
const test = new Base();
test.baseMethod(); // OK
test.extendedtMethod(); // NOT OK, typescript think, Base is still Base …Run Code Online (Sandbox Code Playgroud) 由于谷歌IO刚刚结束,谷歌刚刚发布了Polymer 1.0,我对谷歌的意图越来越失落.
我是一个小团队的开发人员(5-6),我们正在努力为下一个项目找到最好的框架/库.
谷歌几年前发布了Angular.js,这很好,但学习曲线很高,中/大项目的可维护性是一场噩梦.今天,angular2处于alpha状态并且已经非常受到批评.我已经尝试过做一个与firebasedb链接的todoapp(hourliert/angular2-firetodo)并且我喜欢它但是它与aurelia相比非常冗长(查看durandal博客上的最后一篇文章).
目前,我正在使用新聚合物进行(小)webapp.我讨厌聚合物尚未考虑ES6的事实.但我不得不说使用它很好(即使在ES5中).感觉非常严谨.
我的问题是,为什么Google不使用聚合物进行更多的公共应用(我只知道这些聚合物应用:Google音乐,翻译社区,Google IO 2015,就是这样?).似乎角(1)在同一个篮子里.我不知道很多用它构建的Google公共应用程序.然而,谷歌似乎使用Angular进行了1500多个内部项目(我找不到它的来源,你能证实吗?).
最后,我相信,angular2团队将使用聚合物来构建下一个材料ui.由于聚合物元素是可重复使用的WebComponents,它本来不错,可以解释为什么Google维护Angular和Polymer.但似乎没有
除了所有这一切,反应在党内......
2015年是前端非常创新的一年.另一方面,它让人头疼......
如果有人有一些解释,我会很高兴听到他们.
托马斯
我在chrome 44中有此代码的问题(这是小提琴:http : //jsfiddle.net/o6b8rdh8/):
<div id="body">
<div id="header">
Header...
</div>
<div id="content">
<div id="main">
<p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p><p>Content</p>
</div>
<div id="parent">
<div id="background">
</div>
<div id="card">
Lorem...
</div>
</div>
</div>
</div>
#body {
top: 0;
bottom: 0;
right: 0;
left: 0;
position: absolute;
overflow: hidden;
}
#header {
position: fixed;
height: 50px;
background-color: yellow;
opacity: 0.5;
width: 100%;
}
#content {
position: absolute;
top: 50px;
bottom: 0;
right: 0;
left: 0;
overflow: auto;
}
#parent {
position: fixed;
top: 0;
bottom: …Run Code Online (Sandbox Code Playgroud)