我已经在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
我正在尝试显示带有链接(例如 HTML<a>锚标记)的简单图像或文本
<ListView [items]="items | async" (itemTap)="onItemTap($event)">
<template let-item="item">
<StackLayout>
<Image [src]="item.imageUrl" ></Image>
<!--<Image [src]="item.imageUrl" href="http://google.com"></Image>-->
</StackLayout>
</template>
</ListView>
Run Code Online (Sandbox Code Playgroud)
似乎唯一的选择是使用 onItemTap 并获取项目 url 并手动设置要在单独的 webview 上显示的 url 内容。是否有任何标签会自动在手机上打开一个单独的浏览器页面并显示项目的 URL 内容?
我正在尝试遵循本教程:
http://www.blog.bdauria.com/?p=820
并且对本节有疑问:
<GridLayout #boardGrid
[columns]="boardSideSpecification"
[rows]="boardSideSpecification">
<template ngFor let-item [ngForOf]="board.squares">
<StackLayout
[col]="item.yPosition"
[row]="item.xPosition"
[class]="classOf(item)">
</StackLayout>
</template>
Run Code Online (Sandbox Code Playgroud)
问题在于ngFor吐出了第一项,但不会在数组中进一步迭代。所以我最终得到:
以及带有标签生成该代码的实际代码:
<GridLayout #boardGrid
[columns]="boardSideSpecification"
[rows]="boardSideSpecification">
<template ngFor let-item [ngForOf]="board.squares">
<StackLayout
[col]="item.yPosition"
[row]="item.xPosition"
[class]="classOf(item)">
<Label text="{{item.xPosition}}, {{item.yPosition}}"></Label>
</StackLayout>
</template>
</GridLayout>
Run Code Online (Sandbox Code Playgroud)
为了找到合理的解决方案,我已经两天没碰壁了。已经看过了,甚至以编程方式创建了GridLayout,但是一切都带有它自己的特殊问题。
如果有人对如何进行这项工作有任何信息,我将不胜感激。
谢谢!
PS:我想我应该提到我已经检查了其余代码的有效性。我正在获取我期望的项目,等等。除了该迭代器之外,其他所有功能都可以使用。
我将本机脚本从2.5.2更新到了3.0.3。突然,当我尝试运行该应用程序时,出现以下错误:
node_modules / tns-core-modules / tns-core-modules.d.ts(17,27):错误TS2304:找不到名称“ Headers”。
node_modules / tns-core-modules / tns-core-modules.d.ts(19,44):错误TS2304:找不到名称“ RequestInit”。
node_modules / tns-core-modules / tns-core-modules.d.ts(19,66):错误TS2304:找不到名称“ Response”。
我不明白为什么,因为我认为我没有在项目中使用此模块。
谢谢!:)
我想从用户那里获得作为段落(如用户地址)的输入。为此,我正在寻找 nativescript 中的 UI 组件。如果我使用文本字段,是否有任何字符限制。或者我应该在这种情况下使用文本字段。
我已经在我的 Nativescript -Angular 代码中实现了 nativescript 图像选择器插件,但我试图弄清楚如何调整从 nativescript-imagepicker 中选取的图像的大小,该图像可以显示为圆圈中的帐户或个人资料图片
我的iphone模拟器上没有加载字体.我按照https://docs.nativescript.org/ui/styling#using-fonts列出的说明进行操作.但是,字体是为Android加载的,但不是ios.
码:
Label {
font-family: OpenSans-Regular;
}
Run Code Online (Sandbox Code Playgroud)
我在app/fonts文件夹中添加了字体OpenSans-Regular.
当我构建一个{N}应用程序时,ipa或apk文件大小为30MB
tns build ios --release --for-device
Run Code Online (Sandbox Code Playgroud)
并且在上面构建的设备中安装应用程序后,设备的大小为100MB +.任何人都可以帮我这里如何减少应用程序的大小?
- 编写问题在浏览webpack之后,
---我升级到nativescript(2.5.2),angular(2.4.5)和核心模块(2.5.1),将应用程序与webpack(2.2.0)捆绑在一起,app成功运行/捆绑,生成的ipa (与android debug-apk大小相同)在命令下运行时文件大小为21.3MB
npm run build-ios-bundle --release --for-device
Run Code Online (Sandbox Code Playgroud)
但是当应用程序安装在设备/ iTunes中时,应用程序的大小显示为53MB

53MB的应用程序大小也非常庞大,任何人都可以帮助我在这里如何减少应用程序的大小,即使在webpack集成之后.我正在分享我的package.json
{
"description": ".....",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": ".....",
"repository": ".....",
"nativescript": {
"id": "......",
"tns-ios": {
"version": "2.5.0"
}
},
"dependencies": {
"@angular/common": "~2.4.5",
"@angular/compiler": "~2.4.5",
"@angular/core": "~2.4.5",
"@angular/forms": "~2.4.5",
"@angular/http": "~2.4.5",
"@angular/platform-browser": "~2.4.5",
"@angular/platform-browser-dynamic": "~2.4.5",
"@angular/router": "~3.4.5",
"moment": "^2.17.1",
"nativescript-angular": "1.4.1",
"nativescript-angular-snapshot": "1.3.0-5.2.361",
"nativescript-cardview": "^1.2.1",
"nativescript-carousel": "^2.2.0",
"nativescript-dom": "^1.0.8",
"nativescript-fresco": "^1.0.16",
"nativescript-imagepicker": "^2.4.1",
"nativescript-iqkeyboardmanager": "^1.0.1",
"nativescript-pdf-view": …Run Code Online (Sandbox Code Playgroud) 我已经阅读了Nativescript ListView文档并搜索了Google,无法找到任何方法来突出显示当前所选的Listview项目......这甚至可能吗?如果是这样我该怎么办呢?
我的代码:
<ListView [items]="activeStockTakes" class="list-group" (itemTap)="selectActiveStockTake($event)">
<template let-activeStockTake="item">
<StackLayout>
<Label class="list-group-item" [text]="activeStockTake.UserCode + ' - ' + activeStockTake.Comment"></Label>
</StackLayout>
</template>
</ListView>
Run Code Online (Sandbox Code Playgroud) json结构:
{
"Employee": [
{"id":1,"name":"Dan" },
{"id":2,"name":"Stack" },
.....
]
}
Run Code Online (Sandbox Code Playgroud)
app.component.ts:
ngOnInit() {
console.log("first", "Test");
this.globalReader.getObjectData()
.subscribe(data => this.getData = JSON.stringify(data), ---> Response printed successfully here.I'm able to print it in label.
error => alert(error),
() => console.log("finished")
);
}
Run Code Online (Sandbox Code Playgroud)
编辑:
零件:
<label text ="{{getData }}" ></label>
getObjectData() {
return this._http.get('/page/emp.json')
.map((response :Response) => response.json());
}
Run Code Online (Sandbox Code Playgroud)
之后,我不知道如何解析json并在listview中为此结构打印它.我提到了一些视频和杂货申请.但我仍然无法得到结果.我非常困惑arrayname员工.
我需要name在listview中只打印from响应.
typescript nativescript angular2-services angular2-nativescript angular
nativescript ×10
angular ×4
css ×1
fonts ×1
header ×1
html ×1
javascript ×1
module ×1
performance ×1
response ×1
typescript ×1