升级到 '@nativescript/core' 后找不到 Xxport 'topmost'
Posted
技术标签:
【中文标题】升级到 \'@nativescript/core\' 后找不到 Xxport \'topmost\'【英文标题】:Xxport 'topmost' not found after upgrading to '@nativescript/core'升级到 '@nativescript/core' 后找不到 Xxport 'topmost' 【发布时间】:2021-07-10 23:12:32 【问题描述】:在我的 Nativescript Vue 应用程序中,从 tns-core-modules
更改为 @nativescript/core
,现在我遇到了一些问题。我创建了一个类似于this video 的模态服务。在那里我使用了导入:
import * as frameModule from 'tns-core-modules/ui/frame';
我现在改为:
import * as frameModule from "@nativescript/core";
第一个问题是那是否正确。刚刚找到this。
为了将模态放在前面,我使用:
frameModule.topmost()
现在导致警告:
export 'topmost' (imported as 'frameModule') was not found in '@nativescript/core'
这一堆可能的出口。但没有一个听起来像我需要的。
(possible exports: AbsoluteLayout, AccessibilityEvents, AccessibilityLiveRegion, AccessibilityRole, AccessibilityState, AccessibilityTrait, ActionBar, ActionItem, ActionItems, ActivityIndicator, androidApplication, Animation, AnimationCurve, Application, ApplicationSettings, Background, Binding, Builder, Button, CSSHelper, CSSType, CSSUtils, ChangeType, CoercibleProperty, Color, Connectivity, ContainerView, ContentView, ControlStateChangeListener, CoreTypes, CssAnimationParser, CssAnimationProperty, CssProperty, CustomLayoutView, DatePicker, Device, DialogStrings, Dialogs, DockLayout, EditableTextBase, Enums, File, FileSystemEntity, FlexboxLayout, Folder, Font, FontScaleCategory, FormattedString, Frame, GestureStateTypes, GestureTypes, GesturesObserver, GridLayout, GridUnitType, htmlView, Http, iosHelper, Image, ImageAsset, ImageCache, ImageSource, InheritedCssProperty, InheritedProperty, ItemSpec, KeyframeAnimation, KeyframeAnimationInfo, KeyframeDeclaration, KeyframeInfo, Label, LayoutBase, Length, ListPicker, ListView, ModuleNameResolver, NavigationButton, Observable, ObservableArray, Page, PageBase, ParserEvent, ParserEventType, PercentLength, Placeholder, Progress, Property, ProxyViewContainer, PseudoClassHandler, Repeater, RootLayout, Screen, ScrollView, SearchBar, SegmentedBar, SegmentedBarItem, ShorthandProperty, Slider, Span, StackLayout, Style, SwipeDirection, Switch, TabView, TabViewItem, TextBase, TextField, TextView, TimePicker, TouchAction, Trace, Transition, Utils, View, ViewBase, ViewHelper, VirtualArray, WebView, WrapLayout, WrappedValue, XmlParser, _setResolver, action, addTaggedAdditionalCSS, addWeakEventListener, alert, androidDynamicElevationOffsetProperty, androidElevationProperty, animationTimingFunctionConverter, autocapitalizationTypeProperty, autocorrectProperty, backgroundColorProperty, backgroundImageProperty, backgroundInternalProperty, backgroundPositionProperty, backgroundRepeatProperty, backgroundSizeProperty, booleanConverter, borderBottomColorProperty, borderBottomLeftRadiusProperty, borderBottomRightRadiusProperty, borderBottomWidthProperty, borderLeftColorProperty, borderLeftWidthProperty, borderRightColorProperty, borderRightWidthProperty, borderTopColorProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderTopWidthProperty, capitalizationType, clipPathProperty, colorProperty, confirm, dismissKeyboardOwner, dismissKeyboardTimeoutId, eachDescendant, editableProperty, encoding, fontFamilyProperty, fontInternalProperty, fontScaleProperty, fontSizeProperty, fontStyleProperty, fontWeightProperty, fromObject, fromObjectRecursive, getAncestor, getCurrentPage, getFileAccess, getRootLayout, getTransformedText, getViewById, heightProperty, hintProperty, horizontalAlignmentProperty, iOSApplication, inputType, isAndroid, isIOS, isUserInteractionEnabledProperty, keyboardTypeProperty, knownFolders, letterSpacingProperty, lineHeightProperty, login, makeParser, makeValidator, marginBottomProperty, marginLeftProperty, marginRightProperty, marginTopProperty, maxLengthProperty, minHeightProperty, minWidthProperty, opacityProperty, paddingBottomProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, parseCSSShadow, parseKeyframeDeclarations, path, perspectiveProperty, placeholderColorProperty, platformNames, profile, profilingDisable, profilingDumpProfiles, profilingEnable, profilingIsRunning, profilingResetProfiles, profilingStart, profilingStartCPU, profilingStop, profilingStopCPU, profilingTime, profilingUptime, prompt, removeTaggedAdditionalCSS, removeWeakEventListener, resolveFileNameFromUrl, returnKeyTypeProperty, rotateProperty, rotateXProperty, rotateYProperty, sanitizeModuleName, scaleXProperty, scaleYProperty, setActivityCallbacks, textAlignmentProperty, textDecorationProperty, textShadowProperty, textTransformProperty, timeConverter, transformConverter, translateXProperty, translateYProperty, unsetValue, updateTextTriggerProperty, verticalAlignmentProperty, visibilityProperty, whiteSpaceProperty, widthProperty, zIndexProperty, zeroLength)
感谢任何帮助或猜测。
【问题讨论】:
【参考方案1】:Nativescript 8 上的导入略有不同
import Frame from '@nativescript/core';
// and you can use it like this:
Frame.topmost()
【讨论】:
谢谢,我和import Frame from '@nativescript/core';
非常接近,但大括号似乎有很大的不同。以上是关于升级到 '@nativescript/core' 后找不到 Xxport 'topmost'的主要内容,如果未能解决你的问题,请参考以下文章
如何让 Jest 正确转换 node_modules/@nativescript/core? Jest + NativeScript + Angular + Nx
Nativescript 6.0 Android 应用小部件不工作