我知道nativescript曾经支持CSS标准的一个子集.twitter bootstrap是否适用于最新的Nativescript版本?如果没有,是否有任何计划让它发挥作用?
我正在使用带有模板语法的TabView组件来迭代它并在其中添加项目(使用可观察的集合和异步管道).我的商品来自http请求.
我的home.component.tns.html如下:
<ActionBar title="Angular 2 Seed Advanced (nativescript)">
</ActionBar>
<StackLayout>
<TabView selectedIndex="0" selectedColor="#FF0000">
<template ngFor let-tab [ngForOf]="tabs | async">
<StackLayout *tabItem="tab">
<Label text="tab item"></Label>
</StackLayout>
</template>
</TabView>
<Button text="call something" (tap)="emptymethod()"></Button>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
...和我的home.component.ts:
...
export class HomeComponent{
public tabs: Observable<any[]>;
constructor(private _menuService: MenuService) {
this._menuService.getMenu()
.map((menus) => {
let result: Array<any> = [];
if (menus) {
menus.forEach(menu => {
result.push({ 'title': menu.title });
});
}
return result;
})
.subscribe(
data => {
this.tabs = Observable.of<any[]>(data);
},
error => error => …Run Code Online (Sandbox Code Playgroud) 我试图避免NativeScript应用程序中的意外行为.
当我走进任何具有搜索字段(SearchBar)的屏幕时,系统会自动将焦点放在搜索字段上.
然后我得到了一位朋友的帮助,他给了我一个解决这个问题的功能.但我现在面临的问题是我无法获得界面元素.我有以下代码:
import {Component} from "@angular/core";
import {Page} from "ui/page";
import frame = require("ui/frame");
@Component({
selector: "clientes",
templateUrl: "pages/clientes/clientes.html",
styleUrls: ["pages/clientes/clientes.common.css",
"pages/clientes/clientes.css"]
})
export class ClientesPage {
page;
constructor(private _router: Router) {
this.page = <Page>frame.topmost().currentPage;
this.removeSearchFocus();
}
removeSearchFocus() {
var parent = this.page.getViewById('box-lista');
var searchBar = this.page.getViewById('barra-busca');
console.log(JSON.stringify(parent)); // UNDEFINED
console.log(JSON.stringify(searchBar)); // UNDEFINED
if (parent.android) {
parent.android.setFocusableInTouchMode(true);
parent.android.setFocusable(true);
searchBar.android.clearFocus();
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后我有了模板:
<Page.actionBar>
<ActionBar title="Clientes"></ActionBar>
</Page.actionBar>
<StackLayout orientation="vertical" id="box-lista">
<SearchBar hint="Buscar" cssClass="mh mv" id="barra-busca"></SearchBar>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
我的目标是获得搜索字段的自动焦点,但我无法获得界面元素.
javascript android typescript nativescript nativescript-angular
我想在我的登录页面中添加一个活动指示器小部件,但我希望它覆盖整个屏幕,所以我可以防止双击"登录"按钮.
任何想法,谢谢!
如何使用Visual Studio模拟器在Windows中运行NativeScript应用程序?试图获得这个项目:
https://github.com/avatsaev/nativescript-master-detail-angular2
在Windows 10 64位视觉工作室模拟器中运行,但总是在运行时启动android模拟器:
这是我的adb设备:
List of devices attached
169.254.138.177:5555 device
Run Code Online (Sandbox Code Playgroud)
tns livesync android --emulator --watch
也试过了
tns livesync 169.254.138.177:5555 --emulator --watch
没运气!
问候
肖恩
我对Nativescript完全陌生,我试图在点击时将类Name动态添加到gridlayout中。
我没有使用Angular 2。
如何访问网格布局元素并将类名称添加到该元素。
我brew cask install android-idk在Mac OS X上安装android sdk()时遇到问题.我尝试将其安装为nativescript.我读过那些遇到同样问题但找不到工作解决方案的人.我试图改变java路径可能会导致问题.
这是我得到的错误:
==> Caveats
We will install android-sdk-tools, platform-tools, and build-tools for you.
You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:
'export ANDROID_SDK_ROOT=/usr/local/share/android-sdk'
This operation may take up to 10 minutes depending on your internet connection.
Please, be patient.
==> Satisfying dependencies
==> Downloading https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip
Already downloaded: /Users/jhon/Library/Caches/Homebrew/Cask/android-sdk--3859397,26.0.1.zip
==> Verifying checksum for Cask android-sdk
==> Installing Cask android-sdk
==> Warning: Failed to …Run Code Online (Sandbox Code Playgroud) 我正在尝试在NativeScript应用程序中创建具有动态行数和列数的表或数据网格。我有一些产品类别以及这些类别中的某些产品。产品具有有关其所属类别的一些规格。这是图形卡类别中产品的示例JSON:
{
"parts": [
{
"id": 1,
"name": "GTX 1080",
"stockCount": 10,
"specifications": [
{
"id": 1,
"name": "Memory",
"value": "11 GB"
},
{
"id": 2,
"name": "Core Clock",
"value": "1500 MHz"
}
]
},
{
"id": 2,
"name": "RX 580",
"stockCount": 8,
"specifications": [
{
"id": 1,
"name": "Memory",
"value": "8 GB"
},
{
"id": 2,
"name": "Core Clock",
"value": "1366 MHz"
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是CPU类别中的另一个示例:
{
"parts": [
{
"id": 3,
"name": "i5 7600K",
"stockCount": 8, …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个 Nativescript Vue 应用程序,在我的 Android 10 设备 (Samsung S10+) 上进行测试时,状态栏部分覆盖了操作栏。
即使在游乐场应用程序中也可以看到效果。
该问题可以通过删除 android 配置中的透明状态栏选项来解决。但这意味着状态栏的颜色不会是动态的。
有人遇到过这种情况吗?
我对 GraphQL 非常陌生,并尝试将其与 NativeScript Angular 项目一起使用,但当我安装 apollo-Angular 插件时,它没有 ApolloModule 的任何导出成员,如何将 GRAPHQL 服务器与 angurNativeScrt 项目连接。
import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular';
Run Code Online (Sandbox Code Playgroud) nativescript ×10
android ×3
angular ×2
javascript ×2
typescript ×2
css ×1
graphql ×1
homebrew ×1
rxjs ×1
vue.js ×1