对于Cypress中的测试,我想向下滚动到使用Ionic创建的页面底部。
我尝试在窗口上使用scrollTo:
cy.scrollTo('bottom')
Run Code Online (Sandbox Code Playgroud)
但出现错误: 4000ms 后超时重试:cy.scrollTo() 失败,因为此元素不可滚动: <window>
在元素本身上使用scrollIntoView也没有帮助。
还滚动主离子容器:
cy.get('ion-content').scrollTo('bottom')
Run Code Online (Sandbox Code Playgroud)
导致了同样的错误。
有人有想法吗?
我在我的应用程序中使用 Ionic 框架 6 和 Angular 13。我想调整其中离子模态的大小。我试图在创作的同时通过全球课程。它不起作用。我尝试调整包装类的大小。它在 Ionic -5 的早期版本中工作。但不在这里。请帮忙。提前致谢。
公共服务.ts
async createPopup(options) {
options.componentProps.service = this;
const ref = await this.modalController.create({
component: AppModalPopupComponent,
...options
});
if (!this.modalPopup?.length) { this.modalPopup = []; }
this.modalPopup.push(ref);
ref.present();
return ref;
}
component.ts
this.modalService.createPopup(
{
backdropDismiss: true,
componentProps: {
header: 'Update Banner in My Queue',
component: AppUpdateImagePopoverComponent
},
cssClass: "image-popup-modal-css"
});```
Global.scss
.image-popup-modal-css {
height: 100%;
width: 100%;
color: var(--app-secondary-color);
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
}
.image-popup-modal-css .modal-wrapper {
display: grid;
grid-template-columns: …Run Code Online (Sandbox Code Playgroud) 我的离子输入发生变化时就会触发此错误。
我可以用“文本”更改类型来解决问题,但自动完成电子邮件不起作用。
谢谢您的回答 !
错误:
index-06cd27b1.js:1986 DOMException: Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('email') does not support selection.
at Input.valueChanged (http://localhost:4200/node_modules_ionic_core_dist_esm_ion-input_entry_js.js:236:24)
Run Code Online (Sandbox Code Playgroud)
代码 :
<ion-item>
<ion-label position="floating">
<ion-icon name="mail-outline"></ion-icon>
Your email</ion-label
>
<ion-input
type="email"
autocomplete="email"
placeholder="my-mail@gmail.com"
[formControlName]="'email'"
>
</ion-input>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
版本:“@ionic/angular”:“6.0.7”,角度:“^13.1.4”
我使用默认的“ionic start”命令构建了我的应用程序。我选择“空白”应用程序,如果我在浏览器上测试,背景为白色,但如果我在我的 Android 手机上使用“ionic cordova run android”测试相同的空白应用程序,则应用程序背景为黑色。为什么?
我在手机和 android studio 上测试我的离子应用程序时遇到问题,当我按下硬件后退按钮时,应用程序立即退出,我尝试了很多解决方案,但它根本不起作用,也不会听我的任何代码进去。
这是我的尝试
import { Component, Renderer2, ViewChild } from '@angular/core';
import { IonRouterOutlet, Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { TranslateService } from '@ngx-translate/core';
import { Location } from '@angular/common';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
})
export class AppComponent {
@ViewChild(IonRouterOutlet, {static: true}) routerOutlet: IonRouterOutlet
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private renderer: Renderer2,
private translate: TranslateService,
private location: Location …Run Code Online (Sandbox Code Playgroud) 使用电容器相机插件,我尝试用离子相机拍照。不幸的是,每当我调用该函数在浏览器平台上启动相机时,我都会收到以下错误:
unable to load pwa element 'pwa-camera-modal'
Run Code Online (Sandbox Code Playgroud)
一旦发生这种情况,就会打开一个对话框,提示我上传图像,而不是计算机的网络摄像头。我该如何规避这个问题?
我有一个在 Ionic 5 Angular 上编写的 Ionic 项目,其中有一些使用 SweetAlerts2 的弹出窗口。
今天我决定将 Ionic 更新为 Ionic6,但 SweetAlerts2 弹出窗口看起来不正确。就像警报仅在标题上可见,其他所有内容都是空白的。
问题截图:
代码:
swal.fire({
html:
'<br><label style="font-size:80%">Example Alert</label>',
showDenyButton: true,
confirmButtonText: "Confirm",
denyButtonText: "Deny",
denyButtonColor: 'grey',
confirmButtonColor: 'var(--ion-color-primary)',
})
Run Code Online (Sandbox Code Playgroud)
我在 ionic v6/v5 中创建带有多行文本的 ionic 按钮时遇到问题,问题是整个文本出现在一行中,并且部分文本未显示。就像stackblitz中的例子一样
<ion-button expand="block" size="large">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.</ion-button>
Run Code Online (Sandbox Code Playgroud) 当我在浏览器上运行应用程序时出现错误。
ionic cordova run browser
Run Code Online (Sandbox Code Playgroud)
错误是
Error: Unknown argument: platform [ERROR] An error occurred while running subprocess ng. ng.cmd run app:ionic-cordova-build --platform=browser exited with exit code 1. Re-running this command with the --verbose flag may provide more information.
Run Code Online (Sandbox Code Playgroud)
我的配置
离子:
离子 CLI : 6.13.1 离子框架 : @ionic/Angular 6.1.13 @Angular-devkit/build-Angular : 14.0.5 @Angular-devKit/Schematics : 14.0.5 @Angular/cli : 14.0.5 @ionic/Angular -工具包:6.1.0
科尔多瓦:
Cordova CLI:11.0.0 Cordova 平台:浏览器 6.0.0 Cordova 插件:cordova-plugin-ionic-keyboard 2.2.0、cordova-plugin-ionic-webview 5.0.0(以及其他 4 个插件)
公用事业:
科尔多瓦-res:0.15.4 本机运行:1.6.0
系统:
Android SDK 工具:26.1.1 NodeJS:v16.16.0 npm:8.2.0 …
我正在按照本教程https://daviddalbusco.medium.com/add-web-push-notifications-to-your-ionic-pwa-358f6ec53c6f使我的 Ionic Angular 应用程序成为 PWA,并向我的应用程序添加网络推送通知。
当我到达此部分时:
import {Injectable} from '@angular/core';
import {firebase} from '@firebase/app';
import '@firebase/messaging';
import {environment} from '../environments/environment';
@Injectable({
providedIn: 'root'
})
export class NotificationsService {
init(): Promise<void> {
return new Promise<void>((resolve, reject) => {
navigator.serviceWorker.ready.then((registration) => {
// Don't crash an error if messaging not supported
if (!firebase.messaging.isSupported()) {
resolve();
return;
}
const messaging = firebase.messaging();
// Register the Service Worker
messaging.useServiceWorker(registration);
// Initialize your VAPI key
messaging.usePublicVapidKey(
environment.firebase.vapidKey
);
// Optional and not covered …Run Code Online (Sandbox Code Playgroud) firebase typescript ionic-framework progressive-web-apps angular
ionic-framework ×10
angular ×6
android ×2
capacitor ×2
cordova ×2
ionic5 ×2
ionic6 ×2
typescript ×2
background ×1
browser ×1
cypress ×1
firebase ×1
input ×1
javascript ×1
modal-dialog ×1
scroll ×1