标签: ionic-framework

只能使用“allowsyntheticdefaultimports”进行默认导入

我怎样才能解决这个问题?只能使用“allowsyntheticdefaultimports”标志进行默认导入 看截图

types ios ionic-framework

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

无法从 ref 访问 Ionic 组件方法(Vue3)

我正在尝试访问IonList组件的closeSlidingItems方法,以便一旦我单击将该项目向右滑动后从后面出现的按钮,滑动项目就会自动关闭。

我尝试通过放置对 IonList 的引用,然后从该按钮上的单击事件的回调方法访问它来实现此目的。但是,我收到错误:

无法读取未定义的属性“closeSlidingItems”

这是根组件中的代码:

<template>
  <ion-app>
    <ion-list ref="myIonList">
      <ion-item-sliding v-for="user in users" :key="user">
        <ion-item-options side="start">
          <ion-item-option v-on:click="favorite(user)" color="primary">
            <ion-icon slot="icon-only" :icon="heartOutline"></ion-icon>
          </ion-item-option>
        </ion-item-options>

        <ion-item :color="userState(user)">
          <ion-label slot="start">{{ user.name }}</ion-label>
          <ion-label slot="end">{{ user.age }}</ion-label>
        </ion-item>
      </ion-item-sliding>
    </ion-list>
  </ion-app>
</template>

<script>
import {
  IonApp,
  IonContent,
  IonList,
  IonLabel,
  IonItem,
  IonItemSliding,
  IonItemOptions,
  IonItemOption,
  IonIcon,
} from "@ionic/vue";
import { defineComponent } from "vue";
import { heartOutline } from "ionicons/icons";

export default defineComponent({
  name: "App",
  components: {
    IonApp,
    IonList, …
Run Code Online (Sandbox Code Playgroud)

javascript ionic-framework vue.js

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

Ionic 5 将值从模态传递到页面

我需要将数据(仅一个字符串)从模态传递到 Ionic5 上的“父页面”,基本上当用户单击模态的一项时,它应该将字符串传递到页面,该页面在数组中进行过滤并显示结果

这些是模式上的可点击项目:

<ion-row>
  <ion-col class="ion-no-padding-vertical">
    <ion-list class="ion-no-padding-vertical">
        <ion-item class="ion-no-border" button>
          <ion-icon class="ion-input-icon-big" slot="start" name="bu"></ion-icon>
          <ion-label>Burn</ion-label>
        </ion-item>
    </ion-list>
  </ion-col>
</ion-row>

<ion-row>
  <ion-col class="ion-no-padding-vertical">
    <ion-list class="ion-no-padding-vertical">
        <ion-item class="ion-no-border" button>
          <ion-icon class="ion-input-icon-big" slot="start" name="be-battery-weak"></ion-icon>
          <ion-label>Battery Too Weak</ion-label>
        </ion-item>
    </ion-list>
  </ion-col>
</ion-row>
Run Code Online (Sandbox Code Playgroud)

这是模式的 page.ts:

import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
@Component({
  selector: 'app-cmd-v4-modal',
  templateUrl: './cmd-v4-modal.page.html',
  styleUrls: ['./cmd-v4-modal.page.scss'],
})
export class CmdV4ModalPage implements OnInit {
 constructor(private modalController: ModalController) { }
 ngOnInit() { }
 async closeModal() { …
Run Code Online (Sandbox Code Playgroud)

typescript ionic-framework angular

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

Ionic 5 / React:使用 ion-icon 嵌入自定义 SVG

我在 Ionic 5 中有一个 React 应用程序,我想向其中添加一些自定义 SVG。

这个问题是关于 Angular 的,但我的问题是关于 React 的。

我的应用程序文件夹结构如下所示:

  • 源代码
    • 资产
      • 听.svg
      • SvgListen.tsx

这是SvgListen.tsx:

import React from 'react';
import { ReactComponent as ListenSvg } from './listen.svg';
import { IonIcon } from '@ionic/react';

const SvgListen = () => (
  <>
    <ListenSvg />
    <IonIcon src="./listen.svg" font-size="48px" />

  </>
);

export default SvgListen;
Run Code Online (Sandbox Code Playgroud)

在 Chrome 中测试应用程序时,我得到以下 HTML:

<ion-icon src="./listen.svg" font-size="48px" role="img" class="ios hydrated"></ion-icon>
Run Code Online (Sandbox Code Playgroud)

我<ListenSvg />导入的显示正确;但是,不显示离子图标。也没有错误消息。

我查看了这篇博文,但那里概述的方法也没有成功。

如何<IonIcon>在 Ionic 5 中显示自定义 …

svg ionic-framework ionic-react ionic5

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

Ionic 5 中的 Chart.js

我一直在尝试通过查看本教程( https://ichi.pro/es/ionic-5-charts-graphs-usando-la-biblioteca-chartjs-102145521332905 )在Ionic 5中使用Chart.js,但我明白了错误: 在此输入图像描述

除了文件名之外,代码几乎相同。不太明白为什么会发生这种情况,欢迎任何帮助。

import { Component, AfterViewInit, ViewChild , ElementRef } from '@angular/core';
import {Chart} from "chart.js";

@Component({
  selector: 'app-tab3',
  templateUrl: 'tab3.page.html',
  styleUrls: ['tab3.page.scss']
})
export class Tab3Page implements AfterViewInit{
  @ViewChild('lineCanvas') private lineCanvas: ElementRef;

  lineChart: any;

  constructor() { }

  ngAfterViewInit() {
    this.lineChartMethod();
  }

  lineChartMethod() {
    this.lineChart = new Chart(this.lineCanvas.nativeElement, {
      type: 'line',
      data: {
        labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'November', 'December'],
        datasets: [
          {
            label: 'Sell per week',
            fill: false,
            //lineTension: 0.1,
            backgroundColor: …
Run Code Online (Sandbox Code Playgroud)

ionic-framework

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

Ionic Angular - 错误:类型 GooglePlus 没有“?mod”属性

我无法在不出现此错误的情况下导入 GooglePlus。

\n

控制台错误

\n
\n

错误错误:未捕获(承诺):错误:类型 GooglePlus 不\n具有“\xc9\xb5mod”属性。\ngetNgModuleDef@http://localhost:8100/vendor.js:57098:15\nrecurse@http://本地主机:8100/vendor.js:81227:35\nrecurse@http://localhost:8100/vendor.js:81238:24

\n
\n

tab1/tab1.module.ts

\n
...\nimport { Tab1PageRoutingModule } from './tab1-routing.module';\nimport { GoogleSignupComponent } from './google-signup/google-signup.component';\nimport { GooglePlus } from '@ionic-native/google-plus/ngx';\n\n@NgModule({\n  imports: [\n    ...\n    Tab1PageRoutingModule,\n    GooglePlus\n  ],\n  declarations: [Tab1Page, GoogleSignupComponent],\n})\nexport class Tab1PageModule { }\n
Run Code Online (Sandbox Code Playgroud)\n

tab1/google-signup/google-signup.component.ts

\n
...\nimport { GooglePlus } from '@ionic-native/google-plus/ngx';\n@Component({\n  selector: 'app-google-signup',\n  templateUrl: './google-signup.component.html',\n  styleUrls: ['./google-signup.component.scss'],\n})\nexport class GoogleSignupComponent implements OnInit {\n\n  constructor(private googlePlus: GooglePlus) { }\n\n  ngOnInit() { }\n\n  public google() {\n    console.log('google signup');\n    this.googlePlus.login({})\n      .then(res => console.log(res))\n      .catch(err …
Run Code Online (Sandbox Code Playgroud)

ionic-framework google-plus-signin angular ionic5

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

Angular 11、Ionic 5、Capacitor 2 gradle 同步错误“由 org.gradle.api.resources.MissingResourceException 引起”

我在 npx cap open android 上收到以下错误

导致:org.gradle.api.resources.MissingResourceException:无法读取脚本“/Users/adk/Documents/projectA/node_modules/cordova-androidx-build/src/android/cordova-androidx-build.gradle”不存在。

我安装了 cordova-androidx-build 并且 cordova-androidx-build.gradle 文件存在于我的项目的 node_modules 中。node_modules 文件夹也具有读写访问权限。任何帮助深表感谢。

android gradle cordova ionic-framework capacitor

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

如何在 ionic 4 中禁用 --keyboard-offset?

我正在使用 Ionic,我想知道是否有一种方法可以禁用 Ionic 在移动设备上输入时添加到页面的偏移量--keyboard-offset。

现在偏移量弄乱了我的用户界面,如果可能的话我想完全禁用它。

ionic-framework ionic4 capacitor

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

“SplashScreen”插件未在 Android 上实现 CapacitorException.Wrapper

当我将 Ionic 5 项目升级到 Capacitor 3.1.1 时,出现此错误。更新后我开始得到这个。

错误错误:未捕获(承诺):错误:“SplashScreen”插件未在 Android 上实现 错误:“SplashScreen”插件未在 Android 上实现

我在这里需要帮助..

android ionic-framework capacitor

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

使用react-hook-form上传并保存文件列表

我正在构建一个主要针对使用的浏览器的网站Ionic React。我正在尝试使用 areact-hook-form上传文件列表(以及其他数据)并将它们与其他数据一起保存在 FieldArray 中。

我已经按照Ionic Forum 中的这个答案,使用 IonButton 和输入实现了文件上传。

 <input
       type="file"
       id="file-upload"
       style={{ display: "none" }}
       onChange={() => { setFile(index);}}/>
  <IonButton
       onClick={() => {openFileDialog();}}
       disabled={files === undefined || files[index] === undefined}>
     <IonLabel>Upload file</IonLabel>
     <IonIcon slot="start" />
   </IonButton>
Run Code Online (Sandbox Code Playgroud)

代码:

function openFileDialog() {
    (document as any).getElementById("file-upload").click();
  }

const setFile = (index: number) => (_event: any) => {
    console.log(`Getting file for index ${index}`);

    let f = _event.target.files![0];

    var reader = new FileReader();

    reader.onload = function () { …
Run Code Online (Sandbox Code Playgroud)

reactjs ionic-framework react-hook-form

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