我希望用户可以使用 Enter 键在多行的输入字段中插入文本。然后我想将文本保存在一个字符串中,然后将其发送到后端。在应用程序的详细信息页面上,我想显示插入的文本但带有换行符。
在输入的 html 文件中我试过这个
<div>
<ion-item>
<ion-textarea rows="5" name="description" type="text"
placeholder="Description" [(ngModel)]="description" required>
</ion-textarea>
</ion-item>
</div>
Run Code Online (Sandbox Code Playgroud)
在 .ts 中,我对描述字符串进行编码
this.description = encodeURI(this.description);
Run Code Online (Sandbox Code Playgroud)
但是当我想在另一个 html 文件中显示插入的文本时
<ion-col size="12">
<div class="idea-description">
<ion-text style = "white-space: pre-wrap;">{{ idea.description }}</ion-text>
</div>
Run Code Online (Sandbox Code Playgroud)
它只显示编码文本,但没有换行符。
我一直在尝试捕获图像并将其上传到服务器几天但没有运气。我的客户端使用 Ionic 4,后端使用 Java(我使用 Jersey 将后端暴露给 REST)。
现在,问题是在拍摄图像并尝试上传后,我的后端不断收到空值。
这是我的客户端代码:
openCam(){
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
correctOrientation: true,
cameraDirection: 1
}
this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL):
//alert(imageData)
this.imageData = imageData;
this.image=(<any>window).Ionic.WebView.convertFileSrc(imageData);
this.isImageCaptureed = true;
}, (err) => {
// Handle error
alert("error "+JSON.stringify(err))
});
}
upload(){
let url = 'http://mydommain/api/upload';
let dataURL = 'data:image/jpeg;base64,' + this.imageData;
let postData …Run Code Online (Sandbox Code Playgroud) 
我有一个带有离子头像和带有大文本的离子标签的离子项目。为了在 ion-label 中显示全文,我向 ion-label 添加了一个类“ion-text-nowrap”。它工作正常。但问题是 ion-avatar 自动放置到 ion-item 的垂直中心。我不需要对齐头像垂直对齐中间。我想要那个对齐 ion-item 的左上角。我怎样才能做到这一点?
这是我的代码:
<ion-item>
<ion-avatar slot="start">
<img [src]="img">
</ion-avatar>
<ion-label class="ion-text-nowrap">
<p>{{text}}</p>
</ion-label>
</ion-item>
Run Code Online (Sandbox Code Playgroud) 我创建了一个 ionic 5 空白应用程序,并尝试按照文档中的给定说明通过运行在 android 模拟器上运行它 ionic cordova run android -l
离子版本 5.2.7
科尔多瓦版本 9.0.0
摇篮版本 5.6.2
本机运行版本 0.2.8
ANDROID_HOME: D:\Android\sdk
小路:
%ANDROID_HOME%\工具
%ANDROID_HOME%\工具\bin
%ANDROID_HOME%\platform-tools
%ANDROID_HOME%\模拟器
模拟器也在运行
控制台错误 -
> cordova.cmd build android --emulator
[INFO] ... and 78 additional chunks
[ng] i ?wdm?: Compiled successfully.
> native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk --virtual --forward 8100:8100
[native-run] ERR_AVD_HOME_NOT_FOUND: No valid Android AVD home found.
[ERROR] An error occurred while running subprocess native-run.
native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-d... exited with exit code 1.
Re-running this …Run Code Online (Sandbox Code Playgroud) 您好,我正在研究离子应用程序。执行此命令ionic cordova build android --prod --release。它确实生成了未签名的 apk 文件,但它也在 network_security_config 文件中显示错误。
错误
app\src\main\res\xml\network_security_config.xml:4: Error: Missing includeSubdomains attribute [NetworkSecurityConfig]
<domain>localhost</domain>
我尝试了多种解决方案,但对我不起作用。
参考
如何在 Android (9) Pie 中允许所有网络连接类型 HTTP 和 HTTPS?
Cordova 如何支持 Android 7.0 引入的网络安全配置?
有人可以帮我解决这个问题吗?
在构建带有FCM 插件的 Ionic 4 应用程序时,一个非常令人沮丧的问题是无法使用自定义颜色设置自定义通知图标。我想出了如何实现这一点,所以只想与我们美丽的 StackOverflow 社区分享解决方案 :)
因此,请在下面的答案中查看自定义 Firebase Cloud Messaging (FCM) 通知图标及其适用于 Android 平台的颜色的解决方案。
ionic-framework notification-icons firebase-cloud-messaging ionic4
在我用 Ionic 和 Angular 8 构建的 PWA 中,我需要处理回车键以移动到下一个元素。我怎样才能用(keyup.enter)实现它。请帮我。
我正在尝试构建在我的持续集成系统 (Azure) 中使用电容器的 Ionic 应用程序的 iOS 版本。
这是我得到的输出:
/usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace /Users/runner/runners/2.160.1/work/1/s/ios/App/App.xcworkspace -scheme App build CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=iPhone Distribution: <not_displayed> (ENT) PROVISIONING_PROFILE=5254b426-4af0-45e7-aeab-ec63a303d250 PROVISIONING_PROFILE_SPECIFIER=
Build settings from command line:
CODE_SIGN_IDENTITY = iPhone Distribution: swiss1mobile ag (ENT)
CODE_SIGN_STYLE = Manual
PROVISIONING_PROFILE = 5254b426-4af0-45e7-aeab-ec63a303d250
PROVISIONING_PROFILE_SPECIFIER =
SDKROOT = iphoneos13.1
note: Using new build system
note: Planning build
note: Constructing build description
error: Capacitor does not support provisioning profiles. Capacitor does not support provisioning profiles, but provisioning profile ent_frontwork has been manually …Run Code Online (Sandbox Code Playgroud) ion-itemclickable 事件在 ios 中不起作用,但在 android 中工作正常。请帮助我,我在浪费时间,我在谷歌搜索了很多,但找到了任何合适的答案。
<ion-content >
<div>
<ion-searchbar (ionInput)="getItems($event)"></ion-searchbar>
<ion-list lines="full" >
<ion-item class="bg-class" *ngFor="let project of filterData" (click)="onProjectClick(project.npProjCode);">
<ion-icon name="arrow-dropright-circle" style="width: 14px;margin-right: 10px;color: #129bcc;"></ion-icon>
<ion-label>{{project.npProjDescn}}</ion-label>
<ion-icon name="ios-arrow-forward" slot="end" style="color: lightgray;"></ion-icon>
</ion-item>
</ion-list>
</div>
</ion-content>
Run Code Online (Sandbox Code Playgroud) 我已经浏览了这个问题链接,我进行了后续更改,但仍然无法解决问题。仍然给我同样的错误。有人可以帮我吗。提前致谢 这是我来自 config.xml 的一段代码
<widget id="com.farm.fork" version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" >
<application android:usesCleartextTraffic="true" />
<application android:networkSecurityConfig="@xml/network_security_config" />
</edit-config>
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
Run Code Online (Sandbox Code Playgroud)
network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>
Run Code Online (Sandbox Code Playgroud)
AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.farm.fork" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:usesCleartextTraffic="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" …Run Code Online (Sandbox Code Playgroud)