我正在使用 Ionic 和 Capacitor 开发一个应用程序。构建是使用 Ionic 的新 AppFlow 服务生成的,所以我不在本地构建它们。
如何更新 iOS 和 Android 版本号?我已经尝试更新 plist 和 config.xml,但无论我做什么,所有更新都会导致版本号为“1.0”。
我正在构建一个离子2应用程序,我正在使用以下组件
http://ionicframework.com/docs/components/#alert
import { AlertController } from 'ionic-angular';
export class MyPage {
constructor(public alertCtrl: AlertController) {
}
showAlert() {
let alert = this.alertCtrl.create({
title: 'New Friend!',
subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
buttons: ['OK']
});
alert.present();
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能确保当我在框外点击警报时不会被解雇?
我使用"离子加载控制器"来显示一个微调器,直到检索到数据然后它调用"dismiss()"来解除它.它工作正常,但有时当应用程序已经拥有数据时,在"create()"和"present()"完成之前调用"dismiss()",这将保持微调器而不会消失...
我试图在"loadingController.present().then()"中调用数据,但这导致数据变慢...
这是一个错误吗?如何解决这个问题?
我的代码示例:
customer: any;
constructor(public loadingController: LoadingController, private customerService: CustomerService)
ngOnInit() {
this.presentLoading().then(a => consloe.log('presented'));
this.customerService.getCustomer('1')
.subscribe(customer => {
this.customer = customer;
this.loadingController.dismiss().then(a => console.log('dismissed'));
}
}
async presentLoading() {
const loading = await this.loadingController.create({
message: 'wait. . .',
duration: 5000
});
return await loading.present();
}
Run Code Online (Sandbox Code Playgroud) 在ion-back-button不现身的右边ion-menu-button。这是为什么?
在ion-menu-button和ion-title显示正确,并在相同的位置horizantal对齐。
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<!-- navigation button-->
<ion-menu-button></ion-menu-button>
<!-- optional back button-->
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>
{{ pageTitle | translate}}
</ion-title>
</ion-toolbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud)
在 DOM 检查器中, 的 CSSdisplay属性ion-back-button设置为none。为什么它会设置为none?
我用了
this.navCtrl.navigateForward('/term/' + term);
Run Code Online (Sandbox Code Playgroud)
导航到此页面,因此我希望后退按钮可以选择它。为什么navigateForward不添加到堆栈中,这会使ion-back-button显示?
请在下面找到Android硬件后退按钮操作的以下代码ionic3.由于Ionic4采用角路由导航如何弹出事件将发生的后退按钮?如果我们想要弹出到最后一页,我们可以使用以下代码this.navCtrl.goBack('/products');.但是我们如何才能将它用于Android硬件后退按钮动作ionic4呢?
this.platform.registerBackButtonAction(() => {
let activePortal = this.ionicApp._loadingPortal.getActive() ||
this.ionicApp._modalPortal.getActive() ||
this.ionicApp._toastPortal.getActive() ||
this.ionicApp._overlayPortal.getActive();
if (activePortal) {
activePortal.dismiss();
} else {
if (this.nav.canGoBack()) {
***this.nav.pop();***
} else {
if (this.nav.getActive().name === 'LoginPage') {
this.platform.exitApp();
} else {
this.generic.showAlert("Exit", "Do you want to exit the app?", this.onYesHandler, this.onNoHandler, "backPress");
}
}
}
});
Run Code Online (Sandbox Code Playgroud) 我曾尝试过global.scss
ion-content{
background-image: url('assets/images/cover.jpg');
-webkit-background-image: url('assets/images/cover.jpg');
background-repeat: no-repeat;
background-size:cover;
}
Run Code Online (Sandbox Code Playgroud)
但这不会渲染图像.试过路径为./assets/images/cover.jpg.
如果我在显示出无效图像可能性的页面上放置与img标签相同的图像.
我也尝试将homeage.scss放入
.myview {
background-image: url('../../assets/images/cover.jpg');
background-repeat: no-repeat;
background-size:cover;
}
Run Code Online (Sandbox Code Playgroud)
在home.html中使用class ="myview"没有运气
在 Ionic 4 中,我想将数据从 Popover 控制器传递到视图页面。
我能够获取数据,onDismiss()但我想在不退出弹出窗口的情况下进行。
下面是我尝试过的代码片段onDismiss(),它有效。
我们是否可以捕获任何其他弹出窗口方法或状态更改
页
async presentPopover(opts) {
console.log(opts);
const popover = await this.popoverController.create({
component: RouteDetailsPopoverComponent,
componentProps: {
viewType: this.viewType
},
event: opts.event
});
popover.onDidDismiss()
.then((result) => {
console.log(result['data']);
this.viewType = result['data'];
});
return await popover.present();
}
Run Code Online (Sandbox Code Playgroud)
这是弹出组件
changeRouteDetailView(mode: View) {
this.viewType = mode;
this.popCtrl.dismiss(this.viewType);
}
Run Code Online (Sandbox Code Playgroud)
在不关闭弹出窗口的情况下,我可以将数据传回吗?
我开始了一个带有标签模板的项目,后来我决定添加一个侧面菜单。麻烦的是根本没有出现侧面菜单。这是我的app.components.html看起来像
<ion-app>
<ion-split-pane>
<ion-menu side="start">
<ion-header translucent>
<ion-toolbar color="secondary">
<ion-title>Menu</ion-title>
</ion-toolbar>
</ion-header>
<ion-content><ion-list><ion-item>he vik</ion-item></ion-list></ion-content>
</ion-menu>
<ion-router-outlet></ion-router-outlet>
</ion-split-pane>
</ion-app>
Run Code Online (Sandbox Code Playgroud)
实际上,在完成上述操作后,我的实际页面会出现一秒钟,并因此而显示白页。
在控制台中,我看到一个错误
sz7tok82.entry.js:5 Menu: must have a "content" element to listen for drag events on.
Run Code Online (Sandbox Code Playgroud)
但是我已经有了内容元素。
升级到xcode 10.2之后,我的ios版ionic停止使用以下命令构建
离子cordova build ios---buildFlag =“-UseModernBuildSystem = 0”
我试图升级cordova-ios@5.0.0并删除并阅读ios平台,但没有运气。
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 4.0, 4.2, 5.0. This setting can be set in the build settings editor.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 12.2'
** ARCHIVE FAILED **
The following build commands failed:
Check dependencies
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] …Run Code Online (Sandbox Code Playgroud) 我在 ionic4 中使用 ion-datetime 使用 NgModel 绑定到一个属性,但是,无论我在格式中包含什么选项,我总是得到包含时间戳的时间。¿如何从结果中删除时间戳,以便我的属性的最终值类似于“2019-04-22”而不是“2019-04-22T08:45:41.243-05:00”?
我试过了:但是,我仍然得到时间戳
<ion-datetime max="2030" min="2019" [(ngModel)]="mydate" display-format="MMM DD, YYYY"></ion-datetime>
Run Code Online (Sandbox Code Playgroud)
我希望结果类似于:“2019-04-22”,但我不断收到:“2019-04-22T08:45:41.243-05:00”