gpt4 book ai didi

angular - Angular snackbar 中的中心文本

转载 作者:行者123 更新时间:2023-12-02 10:33:39 25 4
gpt4 key购买 nike

在 Angular snackbar 中将文本居中的正确方法是什么?

我已经尝试过这个,但不起作用:

let config = new MatSnackBarConfig();
config.panelClass = 'center';
this.snackBar.open(message, undefined, config);

然后在某个 css 文件中(同一组件或全局文件中):

.center {
justify-content: center;
}

最佳答案

您可以使用 open()panelClass 来完成此操作,但需要修改 CSS:

.center > .mat-simple-snackbar {
justify-content: center;
}

关于angular - Angular snackbar 中的中心文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50936924/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com