我正在学习NativeScript并遵循此处的指南https://docs.nativescript.org/angular/ui/styling。但是我似乎无法使特定平台的CSS正常工作,出现错误“错误:无法解析app.component.common.css。寻找:/data/data/org.nativescript.portalestapp/files/app/ app.component.common.css。“运行代码。
我有这样的文件:
app.component.ts
@Component({
selector: "ns-app",
moduleId: module.id,
templateUrl: "app.component.html",
styleUrls: ["app.component.css"]
})
app.component.common.css
.page{
background-color: #F4F5F7;
font-family:Poppins-Regular, Poppins
}
app.component.android.css
@import './app.component.common.css';
.page {
background-color: blue;
}
我完全遵循指南,但不确定自己在哪里做错了。
我更改了'@import'./app.component.common.css';到@import'/app.component.common.css';而且有效。我不确定为什么