是否可以在它们应该跨越的行/列数量中设置 div 的高度和宽度,而没有具体指定它们应该进入哪些列或行?
例如,如果我有两个类,比如说.long
和.wide
,并且我希望.long
该类为 3 行高和 1 列宽,并且.wide
该类为 3 列宽但只有 1 行高。
我的特定用例涉及 Angular 5,我正在动态加载对象,并希望其中的一些比其他的大。我知道我可以使用 flexboxes 并设置高度来做到这一点,但是很想知道我是否可以用网格实现相同的(更整洁),但我一直在发现每个类都指定了grid-column: x/y; grid-row: a/b
等等。
在Angular 5中,我想使用first()方法,如下所示:
this.ccService.mode.first().subscribe(mode => {
this.mode = mode;
});
Run Code Online (Sandbox Code Playgroud)
我这样导入它:import { first } from 'rxjs/operators/first';
.我也尝试从进口'rxjs/add/operator'
,'rxjs/operators'
,'rxjs'
,似乎没有任何工作.
但是,它拒绝工作,只给出了你在标题中看到的错误信息:[ts] Property 'first' does not exist on type 'Observable<string>'.
.
在mode
观察到:
private modeSource = new BehaviorSubject<string>('new');
public mode = this.modeSource.asObservable();
public setMode(mode: string) {
this.modeSource.next(mode);
}
Run Code Online (Sandbox Code Playgroud)
我一直在谷歌搜索,但我似乎找不到任何有相同错误的人,我只是没有first()
正确使用?我应该用.pipe(first()).subscribe
吗?https://www.learnrxjs.io/operators/filtering/first.html使用observable.first().subscribe
和observable.pipe(first()).subscribe
间歇性不明确的解释和推理,所以我在这里有点失落.