我正在尝试将 Google Maps 插件用于 Nativescript ( https://github.com/dapriett/nativescript-google-maps-sdk ) 和 Angular 2 和 {N}-Angular 路由器。我让它只在 Nativescript 中工作,但是一旦我添加了 Angular 2 和路由器,我就无法让地图显示在 UI 中。
由于<Page>标签没有进入 Angular2 {N} 组件模板,我不能使用xmlns:maps="nativescript-google-maps-sdk"命名空间<Page>来实例化<maps:mapView>
{N} 组件基础知识页面提供了一些指导,但它在我尝试过的方式中不起作用:https : //docs.nativescript.org/ui/ui-with-xml#user-interface-components
关于这样做的正确方法的任何想法是?
app.component.ts
import {Component} from "angular2/core";
import {RouteConfig} from "angular2/router";
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "nativescript-angular/router";
import {HomeComponent} from "./pages/home/home.component";
@Component({
selector: "app-main",
directives: [NS_ROUTER_DIRECTIVES],
providers: [NS_ROUTER_PROVIDERS],
template: "<page-router-outlet ></page-router-outlet>"
})
@RouteConfig([
{ path: "/home", component: HomeComponent, as: "Home", useAsDefault: true },
])
export …Run Code Online (Sandbox Code Playgroud) 如何创建 CSS 以在图像前面制作位置标签。就像 HTML 上的 z-index。我正在使用背景图像,但不起作用。我是用这个代码创建的:
<grid-layout rows="220, auto" columns="*, *, *" id="cardReport" style="background-image: url('{{ foto }}');">
<image src="{{ foto }}" stretch="aspectFill" colSpan="3" row="0" tap="goReport"/>
<label text="{{ namapaket }}" class="info" textWrap="true" row="1" colSpan="1"
horizontalAlignment="center"/>
</grid-layout>
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助。
我很想知道如何在我当前的NativeScript + Angular 2项目上添加侧边菜单,我知道它有一个侧面菜单模板,但我把它作为空白项目开始,我很想知道如何添加这个功能.
我正在使用NativeScript创建一个阿拉伯语(RTL)应用程序.我希望操作栏按照rtl方向排序,因此标题是右侧,菜单选项位于左侧.
我厌倦了使用css和horizontalAlignment,但没有任何效果.
我怎样才能做到这一点?
谢谢.
哪个 Nativescript 模块更适合 http 请求 - http 或 fetch?
计划进行 GET 和 POST 操作 - 大多很简单,没有 cookie 和状态要求。
但我想对 XMLhttprequest 对象进行精细控制 - 例如设置超时值等。
我在我的终端中运行这个命令:
tns doctor --log trace
Run Code Online (Sandbox Code Playgroud)
我得到了这个结果:
execFile: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "help"
execFile: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "help"
spawn: /Users/iyasilias/Library/Android/sdk/platform-tools/adb "--help"
Socket {
_connecting: false,
_hadError: false,
_handle:
Pipe {
bytesRead: 0,
_externalStream: {},
fd: 15,
writeQueueSize: 0,
owner: [Circular],
onread: [Function: onread],
reading: true },
_parent: null,
_host: null,
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: …Run Code Online (Sandbox Code Playgroud) 我已经在nativescript中实现了角度路由导航,我遇到了糟糕的性能,我似乎无法找到它的瓶颈.
这是当前的设置
???????????????????????????????????????????????????????????????????????
? Component ? Current version ? Latest version ? Information ?
? nativescript ? 2.3.0 ? 2.3.0 ? Up to date ?
? tns-core-modules ? 2.3.0 ? 2.3.0 ? Up to date ?
? tns-android ? 2.3.0 ? 2.3.0 ? Up to date ?
? tns-ios ? ? 2.3.0 ? Not installed ?
???????????????????????????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)
可以在这里看到存储库:https: //github.com/felipemullen/teras
您可以看到它是一个基于示例存储库的非常简单的结构.但是,从一个页面到另一个页面的转换大约需要3-4秒,这非常糟糕.
以下是一些截图,展示了应用程序的简单性,几乎没有任何绑定,也没有加载任何数据.所有这一切都是一个按钮通向另一个页面:
所以问题是,为什么这些页面加载速度如此之慢?这只是因为nativescript还很年轻吗?我玩了演示应用程序,他们似乎没有这个问题.
performance nativescript angular2-routing angular2-nativescript angular
考虑以下开关:
<Switch class="switch" formControlName="answer"></Switch>
Run Code Online (Sandbox Code Playgroud)
如果执行此操作,则仅在您尚未激活开关时才起作用,此后即使开关未激活,背景色也将始终相同:
.switch[checked=true] {
background-color: #FE4A49;
color: #FE4A49;
}
Run Code Online (Sandbox Code Playgroud)
如果我这样做:
.switch {
background-color: #FE4A49;
color: #FE4A49;
}
Run Code Online (Sandbox Code Playgroud)
这样,无论状态如何,背景都将始终相同。
将开关与angular的模型绑定一起使用时,样式设置开关的正确方法是什么?
我从最新版本的nativescript开始。
我已经完成了官方页面上的教程,但是现在我的问题比答案更多。
谁能告诉我,我可以使用什么策略来设置一些变量,例如成功登录后如何设置变量甚至更好,如何运行一些在全局进行检查的功能,而不是在每个视图或模型文件上?我看到app.js是应用程序的起点,但看起来它无法进行任何全局检查?
我认为,第二个问题是有关的:几乎每个模型视图文件(称为{viewname}的文件).js都在使用:
var frameModule = require('ui/frame');
Run Code Online (Sandbox Code Playgroud)
有没有办法宣布一次?还是我每次需要框架方法时都必须运行此程序?或者,如果可能的话,会导致性能不佳?
感谢您的任何建议。
在iOS中,当我放置marker和mapView位置时,地图不会居中显示,但是如果我将手机移至横向并再次旋转至纵向,则地图中心将显示正常。在Adnroid工作正常。
您可以在以下github问题中获得更多信息:https : //github.com/dapriett/nativescript-google-maps-sdk/issues/322
nativescript angular2-nativescript nativescript-telerik-ui nativescript-angular nativescript-plugin