Angular w/ Flexbox app-root 不是 100% 宽

Angular w/ Flexbox app-root not 100% wide

我正在尝试使用 Angular 7 w/ Flexbox。

准确地说是布尔玛。

我的 app-root 组件不是 100% 宽。我怎样才能正确地做到这一点?

我的styles.scss长得像

@import "./variables";
@import "~bulma";
html,
body {
    height: 100%;
}

body {
    display: flex;
}

app-root {
    height: 100%;
    width: 100%;
}

这可行,但我不确定以这种方式使用 app-root 是否正确。

你有 app.component.scss 文件吗?

您可以添加它,它应该正确定位该组件。

:host {
    width: 100%;
    height: 100%;
}

:host 用于寻址宿主元素(例如 )。