标签: ionic-framework

Ionic4 本机页面转换不适用于路由器导航

导航到新 url 时,页面转换不起作用。

我已经尝试了所有导航 ionic angular 的可能性routerLink href router.navigateByUrl()。我也尝试过 NativePageTransition 插件。

app.component.html:

<ion-app>
  <ion-content>
      <ion-router-outlet></ion-router-outlet>
      <ion-tabs>
        <ion-tab-bar slot="bottom">
          <ion-tab-button
            *ngFor="let tab of tabs"
            [attr.tab]="tab.action ? null : tab.path"
            (click)="tab.action ? handleTabClick(tab) : null">
            <ion-label>{{ tab.name }}</ion-label>
            <ion-icon [name]="tab.icon"></ion-icon>
          </ion-tab-button>
        </ion-tab-bar>
      </ion-tabs>
  </ion-content>
</ion-app>
Run Code Online (Sandbox Code Playgroud)

app-routing.module.ts:

import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  { path: '', redirectTo: 'explore', pathMatch: 'full' },
  { path: 'explore', loadChildren: './explore/explore.module#ExplorePageModule' },
  { …
Run Code Online (Sandbox Code Playgroud)

ionic-framework angular ionic4

0
推荐指数
1
解决办法
3318
查看次数

ionic 'DocumentScanner' 指的是一个值,但在这里被用作一种类型

我有以下代码:

import {Component} from '@angular/core';
import {DocumentScanner, DocumentScannerOptions, DocumentScannerSourceType} from '@ionic-native/document-scanner';

@Component({
    selector: 'app-tab2',
    templateUrl: 'tab2.page.html',
    styleUrls: ['tab2.page.scss']
})
export class Tab2Page {

    constructor(private documentScanner: DocumentScanner) {
    }

    scan() {
        const opts: DocumentScannerOptions = {
            sourceType: DocumentScannerSourceType.CAMERA,
            fileName: 'ticketScan.png',
            quality: 100,
            returnBase64: true
        };
        this.documentScanner.scanDoc(opts)
            .then((res: string) => console.log(res))
            .catch((error: any) => console.error(error));
    }
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我收到以下错误:

11:42 'DocumentScanner' refers to a value, but is being used as a type here.
Run Code Online (Sandbox Code Playgroud)

谁能告诉我为什么会这样?

javascript ionic-framework angular ionic4

0
推荐指数
1
解决办法
1557
查看次数

如何在 Ionic 4 中更新 ion-searchbar 的高度?

我正在尝试在 Ionic 4 中使用<ion-searchbar>. 我的问题是搜索栏的高度,我无法操作它。我知道 Ionic 4 是基于 Web 组件的,它将每个组件都包装在一个 shadow DOM 中,但<ion-searchbar>似乎没有 shadow DOM,如下所示:

在此处输入图片说明

与其他组件不同,影子 DOM 在节点中可见,如下所示:

在此处输入图片说明

这让我觉得我可以在里面覆盖divwith 类searchbar-input-container<ion-searchbar>但我不能,甚至 Ionic 官方文档也没有涵盖可以实现这一点的任何属性或变量。请帮忙。

ionic-framework angular ionic4

0
推荐指数
1
解决办法
1408
查看次数

ionic - firebase push 只适用于打开的应用程序?

我已经在我的 Ionic 4 应用程序中实现了 FireBaseX 来发送远程通知。

this.platform.ready().then(() => {
  let platforms = this.platform.platforms();

  if(platforms.includes('ios') || platforms.includes('android') || platforms.includes('mobile')){

    this.firebase.getToken().then(token => {
      console.log(`FIREBASE TOKEN ${token}`);
      if(platforms.includes('ios')) this.firebase.grantPermission();
    });

    this.firebase.onMessageReceived().subscribe(data => {
      console.log('FIREBASE MESSAGE', data);
    });

  }

});
Run Code Online (Sandbox Code Playgroud)

因此,当我在 iOS 中打开该应用程序时,它会正确请求权限。

然后我发送测试消息并且 console.log() 正确显示。

2020-02-05 17:35:38.282123-0300 Parkaz[86464:2354851] didReceiveMessage: {
    "collapse_key" = "com.myapp.app";
    from = 678323471xxxx;
    notification =     {
        body = teste;
        e = 1;
        tag = "campaign_collapse_key_5659280550157990837";
        title = teste;
    };
}
Run Code Online (Sandbox Code Playgroud)

但是,如果未打开该应用程序,则什么也不会发生。通知横幅没有出现,没有徽章,没有声音......没有......

难道我做错了什么?

cordova firebase ionic-framework

0
推荐指数
1
解决办法
173
查看次数

Ubuntu 中的 Android 可执行文件快照路径在哪里?

我需要为我的 Ionic 应用程序找到Android 可执行路径,我在 Ubuntu 中安装了带有snap 的Android ,在 Glances 结果中,我可以阅读:

 PID 302   /snap/android-studio/84/android-studio/jre/bin/java -classpath
Run Code Online (Sandbox Code Playgroud)

但是这些文件夹是空的,命令行是:

npx cap 打开 android

我明白了:

[info] Opening Android project at /home/phobos/dev2/reactjs/iotabreact/android
[error] Unable to launch Android Studio. You must configure "linuxAndroidStudioPath" in your capacitor.config.json to point to the location of studio.sh, using JavaScript-escaped paths:
Example:
{
  "linuxAndroidStudioPath": "/usr/local/android-studio/bin/studio.sh"
}
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助。

ubuntu android path haskell-snap-framework ionic-framework

0
推荐指数
2
解决办法
2950
查看次数

IONIC 4:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”执行失败

我在构建 ionic 4 应用程序时遇到问题。每次我尝试构建 android 应用程序时,它都会出现以下错误。

FAILURE: Build failed with an exception.

* What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:   Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 19s …
Run Code Online (Sandbox Code Playgroud)

dex firebase ionic-framework angular ionic4

0
推荐指数
1
解决办法
2237
查看次数

电容器 - 地理定位不适用于 iOS,但适用于 Android

我正在编写一个使用地理定位的应用程序。一切都在网络和 Android 上完美运行。但是,在 ios 上,我无法获取位置(我实现的第二种方法 - 从地图中选择一个位置虽然有效)

我在 Xcode 控制台中收到此错误:

??  To Native ->  Geolocation getCurrentPosition 7620184
ERROR MESSAGE:  {"errorMessage":"The operation couldn’t be completed. 
(kCLErrorDomain error 0.)","message":"The operation couldn’t be completed. 
(kCLErrorDomain error 0.)"}
Run Code Online (Sandbox Code Playgroud)

这是我获取位置的方法:

 private locateUser() {
        if (!Capacitor.isPluginAvailable('Geolocation')) {
            this.showErrorAlert();
            return;
        }
        this.isLoading = true;
        Plugins.Geolocation.getCurrentPosition()
            .then(geoPosition => {

                const coordinates: Coordinates = {
                    lat: geoPosition.coords.latitude,
                    lng: geoPosition.coords.longitude
                };
                this.createPlace(coordinates.lat, coordinates.lng);
                this.isLoading = false;
            })
            .catch(err => {
                this.isLoading = false;
                this.showErrorAlert();
            });
    }
Run Code Online (Sandbox Code Playgroud)

你知道什么可能导致这种情况吗?

geolocation ios ionic-framework capacitor

0
推荐指数
1
解决办法
783
查看次数

Ionic 5 角度返回导航

我在 Ionic 5 中有一个使用 Angular 的应用程序,我需要以编程方式从当前页面导航到上一页。我尝试使用:

this._location.back();
Run Code Online (Sandbox Code Playgroud)

它可以工作,但不会像使用 导航一样触发后退导航动画<ion-back-button>,它只是切换页面。所以问题是如何以编程方式使用 Angular 在 Ionic 5 应用程序上导航,类似于什么<ion-back-button>

ionic-framework angular angular-router

0
推荐指数
2
解决办法
3373
查看次数

Ionic 5 - 删除 ios global 上的 ion-back-button 文本

如何通过 css 或其他方法删除它?Shadow CSS 不允许我以简单的方式做到这一点。

我想为每个页面删除它(全局)

在此处输入图片说明

css ios ionic-framework ionic4 ionic5

0
推荐指数
1
解决办法
1982
查看次数

通过键从数组中删除对象

我有这个数组:

this.menuItems = [
        {
            category: 'category 4',
            items: [
                {
                    type: 'link',
                    icon: '',
                },
                {
                    type: 'link',
                    icon: '',
                },
            ]
        },
        {
            category: 'category 1',
            items: [
                {
                    type: 'text',
                    icon: 'pencil'
                },
                {
                    type: 'checkbox',
                    icon: 'pencil'
                },
            ]
        },
Run Code Online (Sandbox Code Playgroud)

我想从menuItemstype = 中删除对象checkbox。我试过这样:

this.menuItems.forEach(category => {
            category.items.forEach((item, index) => {
                if (item.type === 'checkbox') {
                    category.splice(index, 1);
                }
            });
        });
Run Code Online (Sandbox Code Playgroud)

但不工作。你能帮我一些建议吗?提前谢谢

typescript ionic-framework angular

0
推荐指数
1
解决办法
49
查看次数