因此,Ionic 3将延迟加载的页面和组件引入到框架中.我有应用程序优化延迟加载所有页面,但它仍然有一个缓慢的启动时间.但是,我确实使用了很多本机插件,我认为这可能是启动速度慢的原因.
现在在Ionic中,本机插件包含在Angular中,因此也可以延迟加载插件,以便插件(可能仅在应用程序使用的某些时刻发挥作用)在必要时才会加载,从而改善启动性能?
我正在使用Here(Ionicframework.com)的 Ionic 3 SQLite本机插件,这是我的构造函数代码:
constructor(public navCtrl: NavController,
public menu: MenuController,
translate: TranslateService,
private tts: TextToSpeech,
private sqlite: SQLite) {
this.sqlite.create({
name: 'data.db',
location: 'default'
}).then((db: SQLiteObject) => {
db.executeSql('create table IF NOT EXISTS `localflags`(`flag1` VARCHAR(10),`flag2` VARCHAR(10),`flag3` VARCHAR(10), `flag4` VARCHAR(10));', {})
.then(() => console.log('Table created!!!'))
.catch(e => console.log(e));
}).catch(e => console.log(e));
}
Run Code Online (Sandbox Code Playgroud)
所以,当我使用"ionic cordova run android -lc"在设备上运行时,它会给我这个错误,
Can't resolve all parameters for SQLiteObject: (?)
此代码来自离子原生文档.这是非常基本的代码,我是新手,所以我无法弄清楚这有什么问题.
任何帮助将不胜感激.如果有人能指出我的Ionic 3 SQLite教程,那将是很棒的.提前致谢.
当我运行npm run ionic:build我能够成功构建.但是,当我运行npm run ionic:build --prod我收到以下错误消息.
Error: Type PatientDetailPage in /home/shiva/Ionic/af2-lists/src/pages/patient-detail/patient-detail.ts is
part of the declarations of 2 modules: AppModule in /home/shiva/Ionic/af2-lists/src/app/app.module.ts and
PatientDetailPageModule in /home/shiva/Ionic/af2-lists/src/pages/patient-detail/patient-detail.module.ts!
Please consider moving PatientDetailPage in
/home/shiva/Ionic/af2-lists/src/pages/patient-detail/patient-detail.ts to a higher module that imports
AppModule in /home/shiva/Ionic/af2-lists/src/app/app.module.ts and PatientDetailPageModule in
/home/shiva/Ionic/af2-lists/src/pages/patient-detail/patient-detail.module.ts. You can also create a new
NgModule that exports and includes PatientDetailPage in
/home/shiva/Ionic/af2-lists/src/pages/patient-detail/patient-detail.ts then import that NgModule in
AppModule in /home/shiva/Ionic/af2-lists/src/app/app.module.ts and PatientDetailPageModule in
/home/shiva/Ionic/af2-lists/src/pages/patient-detail/patient-detail.module.ts.
Error: Type PatientDetailPage in /home/shiva/Ionic/af2-lists/src/pages/patient-detail/patient-detail.ts …Run Code Online (Sandbox Code Playgroud) 我已经使用Ionic 3框架开发了一个应用程序。我想衡量我的应用程序的CPU和内存使用率。最佳做法是什么?
我需要401在我的Ionic 3应用上正确处理错误.当应用程序未使用几天并且该用户尝试访问该应用程序之后,会出现以下提到的错误.这个应用程序有一个后端Web API(Django),它使用jwt令牌来验证用户.
那么你能告诉我在Ionic 3app 上处理这种用例的正确工作流程吗?我无法找到很好的资源来在网上推荐这个.如果你有分享的东西,那就太好了.
我已经看到了它提到的这个URLsubscribe subjects.但我不知道如何使用Ionic app实现这样的功能.有什么线索吗?
authProvider.ts
import { Injectable, } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { Headers, RequestOptions, BaseRequestOptions } from '@angular/http';
import { Storage } from '@ionic/storage';
createHeader(headers: Headers) {
return new Promise((resolve, reject) => {
this.storage.get('loggedInUser')
.then((token: any) => {
if (token) headers.append('Authorization', 'token ' + token.token);
resolve(headers);
}, err => {
resolve(headers); …Run Code Online (Sandbox Code Playgroud) 我想app.component.ts从其他页面(otherpage.ts)或其他组件访问和更改变量或访问方法,如;
app.component.ts
@Component({
templateUrl: 'app.html'
})
export class MyApp {
accessedVariable: any;
constructor(){ }
accessedMethod() {
..something
}
}
Run Code Online (Sandbox Code Playgroud)
otherpage.ts
@Component({
selector: 'page-other',
templateUrl: './otherpage.html',
})
export class OtherPage {
constructor() { }
}
Run Code Online (Sandbox Code Playgroud) 这是关于最新的Firebase Cloud Firestore的问题.在这个文档中,它是这样说的:
它还允许表达性查询.查询按结果集的大小进行缩放,而不是数据集的大小,因此您将获得相同的性能,从100或100,000,000的集合中获取1个结果.
这个陈述对我来说并不清楚.你能解释一下这个用例吗?
我在构建我的离子3应用程序时遇到了麻烦.每次我尝试构建Android应用程序时都会出现以下错误.
* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value val
ue=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:2
7:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] Androi
dManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element a
t AndroidManifest.xml:25:5-27:34 to override.
Run Code Online (Sandbox Code Playgroud)
我的离子信息如下:
cli包:(C:\ Users\SystemOne\AppData\Roaming \npm \node_modules)
@ionic/cli-utils : 1.18.0
ionic (Ionic CLI) : 3.18.0
Run Code Online (Sandbox Code Playgroud)
全球套餐:
cordova (Cordova CLI) : 6.5.0
Run Code Online (Sandbox Code Playgroud)
本地包裹:
@ionic/app-scripts : 3.0.0
Cordova Platforms : none
Ionic Framework : ionic-angular 3.7.1
Run Code Online (Sandbox Code Playgroud)
系统:
Node : v6.10.0
npm : …Run Code Online (Sandbox Code Playgroud) 我实际上正在使用离子存储。我听说过Ionic Native Storage,但我不知道它们之间的确切区别。
谢谢!,
我的离子项目中有一个微调器。我想将微调器放在屏幕的中央位置。但它始终显示在左上角,如下所示:
HTML文件是:
<div *ngIf="spinner == 'true'">
<ion-spinner name="bubbles"></ion-spinner>
</div>
Run Code Online (Sandbox Code Playgroud)
我的scss文件是:
page-login {
ion-spinner {
width: 28px;
height: 28px;
stroke: #444;
fill: #222;
}
}
Run Code Online (Sandbox Code Playgroud)
你能帮我吗?
ionic3 ×10
angular ×6
ionic2 ×5
typescript ×4
cordova ×3
firebase ×1
ionic-native ×1
lazy-loading ×1
performance ×1
sqlite ×1