angular - 如何在 nativescript 中使用自定义主题?
问题描述
我目前正在开发一个可能具有不同主题的应用程序,具体取决于客户端,以前此功能是使用akylas-teme 制作的。
但我将项目迁移到 angular 11 和 nativescript 7,所以这个解决方案不再适用于我。
我怎样才能执行与以前相同的功能?为每个客户提供动态主题。
如果需要执行解决方案,我将提供有关我的项目的更多信息,非常感谢
解决方案
将根类添加到您的页面
xml/html:
<Page class="blue-theme">...
js:
changeTheme () {
page.className = 'red-theme';
}
scss:
@import "~@nativescript/theme/core";
@import "~@nativescript/theme/default";
.blue-theme {
@import "~@nativescript/theme/blue";
}
推荐阅读
- python - 使用 python 中的 URL 和文件路径将 csv 导出到特定文件夹
- visual-studio-code - 使用代码打开在 VSCode 中不起作用 - 找不到应用程序
- swift - 我试图在 swiftUI 中将自定义数据保存到云 Firestore,我试图构建从快照侦听器获得的数据
- python - 如何使用python将pdf页面倒置?
- javascript - TypeError:无法读取未定义 Fast2sms 的属性“加入”
- google-cloud-platform - 尽管 apache2 已启动,但无法通过外部 IP 访问 GCP VM 实例
- python - 无法使用 pysockets 从服务器接收消息
- python-3.x - 将 SQLite 3 与 python 一起使用
- amazon-web-services - 将 Namecheap 域添加到 AWS Elastic Beanstalk
- javascript - 来自儿童的上下文 API setState