nativescript - 编译器错误 screen.mainScreen 是“屏幕”类型的静态成员
问题描述
帮助!。编译器返回错误
属性“mainScreen”是“Screen”类型的静态成员
我正在尝试获取 heightDIP,但是这个。
解决方案
您可能想检查Screen
从哪里导入。过去我遇到过 VS Code 会自动导入错误的问题Screen
。
import { Screen } from '@nativescript/core';
// and the following should work
Screen.mainScreen.heightDIPs
推荐阅读
- python - 在opencv中使用MSER检测灰度图像上的白色斑点
- shopify - 是否可以向 Shopify 中的所有产品批量添加元字段?
- javascript - 来自服务器的 React-Native 动态数组
- python - 如何将文件传输到转换器功能
- hibernate - JOIN FETCH 查询未在 Spring DataJpaTest 中获取惰性集合
- c# - 使用自定义 Content-Type 发送 SMTP 电子邮件
- node.js - egg-sequelize server online error: Class constructor LRUCache cannot be invoked without 'new'?
- javascript - 未捕获(承诺):NullInjectorError: StaticInjectorError(AppModule)[CdkConnectedOverlay -> Overlay]
- jquery - 在全屏覆盖中定位的问题
- javascript - Mobx-state-tree 操作在 Visual Studio 代码中不可用