我刚刚开始使用NativeScript,虽然我喜欢到目前为止看到的内容,但是在运行时我无法理解如何查看控制台输出(例如):
tns run ios --emulator
Run Code Online (Sandbox Code Playgroud)
该命令立即存在于提示符中,因此它不会在终端窗口中输出控制台日志.我可以在线查看AppBuilder的一些参考资料,这是一款付费的Telerik工具.这是在调试时查看控制台日志的唯一方法吗?
嗨,我正在尝试过滤通过SearchBar的按键上的HTTP请求获取的可观察数据数组.
我设法让SearchBar属性更改工作,但我似乎无法弄清楚我在过滤逻辑中做错了什么.
理想情况下,我想在我输入搜索词时更新列表SearchBar.我在Telerik网站上搜索了API,我找不到任何实例.
XML
<Page loaded="pageLoaded">
<ActivityIndicator busy="{{ isLoading }}" />
<ActionBar title="People">
</ActionBar>
<GridLayout>
<StackLayout>
<SearchBar id="searchBar" hint="Search for someone"></SearchBar>
<ListView items="{{ peopleList }}" itemTap="showDetail">
<ListView.itemTemplate>
<StackLayout>
<Label text="{{ fullName }}" horiztonalAlignment="left" verticalAlignment="center"></Label>
<Label text="{{ company }}" class="info"></Label>
</StackLayout>
</ListView.itemTemplate>
</ListView>
</StackLayout>
</GridLayout>
</Page>
Run Code Online (Sandbox Code Playgroud)
JS
var frames = require("ui/frame");
var Observable = require("data/observable").Observable;
var PeopleListViewModel = require("../../shared/people-viewModel");
var activityIndicatorModule = require("ui/activity-indicator");
var page;
var userkey;
var peopleList = new PeopleListViewModel([]);
var pageData = new Observable({ …Run Code Online (Sandbox Code Playgroud) 我从以下问题找到了在Android WebView中启用/禁用缩放控件的方法.
我正在使用NativeScript,我在NativeScript WebView中看不到类似的方法.有什么办法可以从NativeScript访问Android WebView的方法吗?或者,还有其他方法吗?
谢谢.
我正在开发一个涉及推送通知的NativeScript应用程序.无论何时推送通知我都需要将通知内容存储到数据库中.
为此,我在"onMessageReceived"函数中编写了一些代码.此代码位于GCM注册码所在的页面中.
如果app正在运行,那么每件事情都运转正常 问题是如果应用程序关闭,则"onMessageReceived"函数甚至不执行(我使用控制台日志检查).
所以为此我试图在app.js中放置"onMessageReceived"函数,这样即使应用程序关闭它也会执行.为此我试图在app.js中导入"nativescript-push-notifications",但是错误说"应用程序为空,它没有正确传递" .Below是我的app.js代码.
app.js
var application = require("application");
var gcm=require("nativescript-push-notifications");
if(gcm.onMessageReceived) {
gcm.onMessageReceived(function callback(data) {
console.log("message received:::: ", "" + JSON.stringify(data));
storeInDatabase(data);// some function to store notification content into db.
});
}
application.mainModule="main-page";
application.start({ moduleName: "main-page" });
Run Code Online (Sandbox Code Playgroud)
我们可以在app.js中导入"nativescript-push-notifications"引用吗?
任何建议都会有所帮助.谢谢.
android push-notification google-cloud-messaging nativescript
是否可以在列表视图中获取抽头项的上下文?例如,如果我有一个包含三个项目的列表,我如何判断它是第二个单击的项目,并从可观察数组中的该项目的对象中获取数据?
EX:这是我的列表模板,如果用户点击了连接列表中的第二个连接,我怎么能根据点击的项目索引获得与该连接相关的数据?
<ListView items="{{ connections }}" loaded="" itemLoading="" itemTap="">
<ListView.itemTemplate>
<StackLayout class='connection-li'>
<GridLayout class="connection-info" rows="" columns="auto, *, *" tap="goToMeasurements">
<Image col="0" src="res://ic_person_black_36dp" stretch ="none" />
<Label col="1" class="connection-name" text="{{ PatientFirstName + ' ' + PatientLastName }}" textWrap="false" />
<Image col="2" verticalAlignment="middle" horizontalAlignment="right" src="res://ic_cancel_black_18dp" stretch ="none" />
</GridLayout>
</StackLayout>
</ListView.itemTemplate>
</ListView>
Run Code Online (Sandbox Code Playgroud)
编辑:根据文档,我发现以下事件,我可以挂钩获取索引数据,但它引用ListView的方式我如何使其具体引用我感兴趣的那个,我可以给它一个类并以这种方式访问它?
listView.on(listViewModule.ListView.itemTapEvent, function (args: listViewModule.ItemEventData) {
var tappedItemIndex = args.index;
var tappedItemView = args.view;
//// Do someting
});
Run Code Online (Sandbox Code Playgroud) 我必须为IOS和Android创建移动应用程序.我对使用NativeSript问题很感兴趣,UI非常复杂,我不确定这个框架是否会管理它.因为我使用Js和Java的工作不是问题,我已经准备好后端了.
最好的问候卢克
我需要为我的nativescript角度应用构建一个多项目选择UI元素。似乎没有支持多种选择的nativescript UI组件。关于如何为我的应用程序实现此功能的任何示例?
我正在尝试设置nativescript开发环境.我按照官方文件中描述的步骤进行操作.链接
之后我通过使用创建了一个新项目
tns create my-first-app --template tns-template-hello-world-ng
Run Code Online (Sandbox Code Playgroud)
然后我使用以下命令添加了iOS和Android平台
tns platform add ios
tns platform add android
Run Code Online (Sandbox Code Playgroud)
执行时
tns run android
Run Code Online (Sandbox Code Playgroud)
一切正常.模拟器正在启动,应用程序打开.
但是,在跑步时
tns run ios
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Searching for Devices...
spawn EACCES
Run Code Online (Sandbox Code Playgroud)
我已经尝试更改app目录的权限
sudo chmod -R a+rwx /[AppFolder]
Run Code Online (Sandbox Code Playgroud)
执行
sudo tns run ios
Run Code Online (Sandbox Code Playgroud)
没有解决问题
编辑2017-10-5 回应Nikolai Tsonevs回答:
执行以下命令,并没有解决问题:
tns platform remove ios
npm cache clean --force
tns platform add ios
tns run ios
Run Code Online (Sandbox Code Playgroud)
我的节点版本是:v8.4.0我的npm版本是:5.4.2
我还执行以下操作与你分享输出(假设,尼古拉意味着ios而不是android):
tns platform remove ios
tns platform add ios --log trace > out.txt
Run Code Online (Sandbox Code Playgroud)
这是输出: …
有没有办法在已经绘制之后更改/设置GridLayout行的高度?
例如,我有一个像这样的GridLayout设置:
<GridLayout class="template_body" rows="40,*,60">
<StackLayout row="0" [visibility]="isTablet ? 'visible' : 'collapsed'">
<Label text="Drag statements to the proper category."></Label>
<FlexboxLayout flexDirection="row" row="1" [visibility]="isSubmitted ? 'visible' : 'collapsed'">
<AbsoluteLayout height="10" width="10" class="correct-legend"></AbsoluteLayout><Label class="legend-label" text="Correct"></Label>
<AbsoluteLayout height="10" width="10" class="incorrect-legend"></AbsoluteLayout><Label class="legend-label" text="Incorrect"></Label>
</FlexboxLayout>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
我想根据条件更改第一行的高度。到rows =“ 100,*,60”
我尝试通过在gridlayout上使用getRows()获取行,但是似乎无法对返回的内容执行任何操作。看来它正在返回一个Observable而不是api表示应该返回的行数组。
在预览模式下,我无法查看操作栏图标,但是如果我在android中构建项目,则可以看到它们。在控制台中,我有这个:
LOG from device OnePlus X: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
LOG from device OnePlus X: Error: Could not load action bar icon: res://back
Run Code Online (Sandbox Code Playgroud)