我有一个本地脚本角度应用程序,它运行蓝牙服务来连接到外围设备(设备)。该应用程序会显示一个标签,其中包含一条消息,指示尚未将蓝牙设备连接到运行该应用程序的移动设备。我想做的是更新 UI,以便标签在发生连接时消失(并在发生断开连接时重新出现)。
应用程序组件.tns.html
<StackLayout orientation="vertical" marginBottom="50">
<Label text="No bluetooth device detected." id="noBluetoothWarning" horizontalAlignment="center" color="#B11" *ngIf="bluetoothDisconnected" marginTop="30" visibility="{{ isBluetoothConnected ? 'collapsed' : 'visible' }}"></Label>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
应用程序组件.ts
export class NSAppComponent extends AppComponent implements OnInit {
pageData: Observable;
ngOnInit() {
this.bluetoothDisconnected = true;
let _page = <Page>topmost().currentPage;
_page.actionBarHidden = true;
_page.frame.bindingContext = this.pageData;
let that = this;
this.bluetoothScanner.connectionStateChangeEvent.subscribe((connectionState) => {
that.log.debug(`Am I in an angular zone? ${NgZone.isInAngularZone()}`);
this.ngZone.run(() => {
that.log.debug(`connectionStateEvent triggered! state is: ${connectionState}`);
that.bluetoothDisconnected = !connectionState;
that.pageData.set("isBluetoothConnected", connectionState);
that.pageData.notify({ object: that.pageData, …Run Code Online (Sandbox Code Playgroud) 有没有办法在模态页面上实现带有粘性页眉和页脚的滚动视图。像这样的粘性页眉/页脚,中间有 ScrollView
这是我已经准备好的,但是包含社交按钮的 GridLayout 被截断了。
<Page xmlns="http://schemas.nativescript.org/tns.xsd" shownModally="onShownModally" class="test">
<StackLayout orietation= "veritcal" class="mainstack">
<GridLayout rows="auto" columns="*, auto">
<label text="{{title}}" textWrap="true" class="size16b align-center" col="0" row="0" />
<Button text="" horizontalAlignment="right" tap="closePage" class="btn" col="1" row ="0"/>
</GridLayout>
<ScrollView>
<ios><HtmlView class="stack" html="{{htmlString}}" /></ios>
<android><WebView class="stack" src="{{htmlString}}" id="andWebView"/> </android>
</ScrollView>
<GridLayout rows="auto" columns="*, *, *, *" class="gridLay">
<Button text="" horizontalAlignment="center" tap="closePage" class="socialbtn" col="0"/>
<Button text="" horizontalAlignment="center" tap="closePage" class="socialbtn" col="1"/>
<Button text="" horizontalAlignment="center" tap="closePage" class="socialbtn" col="2"/>
<Button text="" horizontalAlignment="center" tap="closePage" class="socialbtn" col="3"/>
</GridLayout>
</StackLayout>
</Page> …Run Code Online (Sandbox Code Playgroud) 我需要重命名我的应用程序,但我不确定从哪里开始。我尝试手动更改一些文件夹/文件的名称,但一切都失败了,我想是因为使用原始名称的事情比我预期的要多。我查看了以下帖子,但不幸的是,它适用于 Android(我正在构建一个 iOS 应用程序)。重命名应用程序名称
javascript nativescript angular2-nativescript nativescript-angular angular
我需要使用 nativescript 的最简单的获取和显示示例。如果有人有一些 github 存储库,我将不胜感激。谢谢 实际上,我想读取一个 JSON 并在本机脚本的列表中显示数据。
我想使用 Nativescript-Vue 将动态子组件添加到父组件。例如:
<template>
<MyParentComponent>
<MyChildComponent :foo="foo"></MyChildComponent>
</MyParentComponent>
<template>
<script>
import MyParentComponent from './components/MyParentComponent';
import MyChildComponent from './components/MyChildComponent';
export default {
components: {
MyParentComponent,
MyChildComponent
},
data: function(){
return {
foo: ''
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
我想我需要在父组件中定义一个插槽,在其中插入子组件,但我不知道应该如何完成。
有任何想法吗?
当我尝试通过运行安装 nativescriptt 时npm i -g nativescript,收到以下错误:
npm WARN checkPermissions Missing write access to
/usr/local/lib/node_modules/nativescript
npm ERR! path /usr/local/lib/node_modules/nativescript
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access
'/usr/local/lib/node_modules/nativescript'
npm ERR! enoent This is related to npm not being able to find a
file.
Run Code Online (Sandbox Code Playgroud)
我尝试以 sudo 身份运行该命令并收到相同的结果。我还尝试向该node_modules目录添加写权限。
我在 macOS High Sierra 上运行节点 v10.6.0。
我从 nativescript 开始。我正在尝试构建一个 hello world 应用程序来测试它。但是,当我运行它时,我得到一个退出状态 127 for command not found。
这是我尝试构建的方法:
[ahmed@localhost hello]$ tns build android
Executing before-shouldPrepare hook from /home/ahmed/PycharmProjects/hello/hooks/before-shouldPrepare/nativescript-dev-webpack.js
Skipping prepare.
Building project...
Gradle build...
spawn ./gradlew ENOENT
[ahmed@localhost hello]$ echo $?
127
[ahmed@localhost hello]$
Run Code Online (Sandbox Code Playgroud)
如果我跑tns doctor,一切似乎都好
[ahmed@localhost hello]$ tns doctor
? Getting environment information
No issues were detected.
? Your ANDROID_HOME environment variable is set and points to correct directory.
? Your adb from the Android SDK is correctly installed.
? The Android SDK …Run Code Online (Sandbox Code Playgroud) 我使用以下命令新安装了 Nativescript Angular 项目:
\nng new --collection=@nativescript/schematics my-mobile-app\nRun Code Online (Sandbox Code Playgroud)\n我从nativescript-schematics获得的命令
\n全新安装后,我尝试在 Android 模拟器上运行它。
\ntns run android\nRun Code Online (Sandbox Code Playgroud)\n然后我在编译过程中收到此错误:
\nSearching for devices...\nPreparing project...\nFile change detected. Starting incremental webpack compilation...\n\nwebpack is watching the files\xe2\x80\xa6\n\nHash: c018afa003f9a5a7d1cd\nVersion: webpack 4.44.2\nTime: 4451ms\nBuilt at: 11/05/2020 1:54:33 PM\n 3 assets\nEntrypoint bundle = runtime.js vendor.js bundle.js\n[./app.css] 1.05 KiB {bundle} [built]\n[./main.ts] 1.13 KiB {bundle} [built]\n[~/package.json] external "~/package.json" 42 bytes {bundle} [optional] [built]\n + 331 hidden modules\n\nERROR in error TS5060: Option \'paths\' cannot be used without …Run Code Online (Sandbox Code Playgroud) webpack nativescript angular2-nativescript nativescript-angular angular
我尝试使用这样的 nativescript 但它不起作用:
battery = navigator.battery || navigator.webkitBattery || navigator.mozBattery || navigator.msBattery;
console.log("battery level: ", Math.floor(this.battery.level * 100) + "%");
Run Code Online (Sandbox Code Playgroud) 我是 javascript 新手,特别是 vue js。我找到了 3 个“框架” cmiiw来使用 vue.js 构建本机应用程序。1. Native Script (使用 vue.js) -> https://www.nativescript.org 2. Vue Native -> https://vue-native.io/ 3. NativeScript-Vue -> https://nativescript- vue.org/
您对这三个“框架”有何看法?哪一个最适合构建本机应用程序。
所以我想使用Vuejs构建一个小型原生移动应用程序.我知道有两个平台可以使用VueJs开发本机移动应用程序; Weex和Nativescript.这是我的问题:
1-您是否使用过任何平台?如果是的话,它们有什么好处吗?(到目前为止,我听到了不好的评论)
2 - 根据我的研究,React Native比两个平台都要好,所以我很高兴知道这里是否有人使用' Vuejs to ReactJs converter '?React-Vue:https://github.com/SmallComfort/react-vue
3-我应该放弃我的VueJs背景并去Reactjs和React Native吗?
谢谢
web-deployment angularjs nativescript mobile-development weex
nativescript ×13
angular ×3
javascript ×2
android ×1
angularjs ×1
fetch ×1
image ×1
ios ×1
node-modules ×1
npm ×1
vue.js ×1
vuejs2 ×1
webpack ×1
weex ×1
zone ×1