在 ionic 3 中,我可以使用 override css 样式设置 ion-radio 的样式
.radio-md .radio-icon{
display: none;
}
.item-md{
border: 1px solid color($colors,divider);
border-radius: 6px;
}
.item-radio-checked{
border: 1px solid color($colors,primary);
}
Run Code Online (Sandbox Code Playgroud)
我对 ionic 4 不知道。
如何使用 ionic v4 设计 ion-radio 样式?
我正在我的 Ionic 4 项目中工作,并且创建了一个自定义组件,但在该自定义组件中我[(ngModel)]无法工作。
这是我的custom-header-component.component.html:
<ion-select [(ngModel)]="languageSelected" (ionChange)='setLanguage()' ngDefaultControl>
<ion-select-option value="en">English</ion-select-option>
<ion-select-option value="ar">Arabic</ion-select-option>
</ion-select>
Run Code Online (Sandbox Code Playgroud)
在此 html 中,my[(ngModel)]不起作用,因为它没有在控制台中打印任何值。
这是我的自定义标头组件.component.ts:
languageSelected: any;
setLanguage() {
let me=this;
console.log('languageSelected',me.languageSelected);
}
Run Code Online (Sandbox Code Playgroud)
在此 ts 文件中,它没有打印任何值。
也许问题是,我没有包含FormsModule.
这是我的文件夹:
custom-header-component:
|
-- custom-header-component.component.html
-- custom-header-component.component.scss
-- custom-header-component.component.spec.ts
-- custom-header-component.component.ts
components.module.ts
Run Code Online (Sandbox Code Playgroud)
这是我的Components.module.ts:
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CustomHeaderComponentComponent } from './custom-header-component/custom-header-component.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@NgModule({
declarations: [CustomHeaderComponentComponent],
exports: [CustomHeaderComponentComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA], …Run Code Online (Sandbox Code Playgroud) 如何创建一个带有 + 和 - 按钮的输入框。单击哪个用户可以更改所选产品的数量,如此屏幕图像

我知道这个问题之前就在这里,但它不是 ionic3 并且答案不起作用,因为所有值都会增加或减少 <- 这个问题被添加到那里,但没有人回答
我正在尝试在 IONIC 应用程序内的 iframe 中显示我的网站之一。我需要限制我的网站被其他网站嵌入框架。我决定使用内容安全策略响应标头,其中
Content-security-policy: frame-ancestors ${website-to-be-allowed}
确保只有提到的网站可以 iframe 我的网站,但是我也需要我的 ionic 应用程序来 iframe 我的网站,并且由于 Ionic 应用程序用作文件系统,我可以将所有文件系统的访问权限授予 iframe 我的网站。当我添加
Content-security-policy: frame-ancestors ${website-to-be-allowed} filesystem
如此处所述, https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors
我在 Android 和 IOS 应用程序上进行了测试,并且都抛出了相同的错误,内容如下:
Refused to display ${website} in a frame because an ancestor violates the following content security policy directive: "frame-ancestors filesystem"
这是弹出的错误,在此处输入图像描述
如果 itemNew.UL_DATA 和 itemNew.LL_DATA 等于 0 或“”,如何将输入限制为仅具有 2 位小数的数字。
<ion-col col-2>
<input (keypress)="ShowKey();"
[style.display]="itemNew.UL_DATA=='0' && itemNew.LL_DATA=='0'?'none':'inherit'"
style="width: 100%;flex-grow: 1; align-self: flex-end;"
type="text" placeholder="Actual After Value"
[(ngModel)]="itemNew.ACTUAL_VALUE_L"
name="ActualData"
id="ActualData">
</ion-col>
Run Code Online (Sandbox Code Playgroud) 我有一个使用 Angular 7 开发的 Ionic 4 应用程序,如果我第一次进入页面,则 ionViewDidEnter 事件会起作用,但如果我移动到另一个页面并返回,则该事件不会触发。
\n\n我从 Angular 更改为 ngOnDestroy,这在页面首次加载时有效,但当我转到页面并返回时,它也不起作用。
\n\n我真正的问题是,我有一个登录页面和一个主页面板页面,当我从 app.component.ts 启动应用程序时,他会验证用户是否已登录,是否将用户重定向到使用此代码的面板主页
\n\nthis.router.navigate(['painel/home']);\nRun Code Online (Sandbox Code Playgroud)\n\n发生这种情况时,此页面出现时,此事件ionViewDidEnter 和 ionViewWillEnter起作用,但是当我单击按钮注销时,我的应用程序会清除缓存并将导航更改到此页面 auth.component.ts 这是注销中的代码
\n\npublic logout(refresh?: boolean): void {\n this.tokenStorage.clear();\n if (refresh) {\n this.router.navigate(['auth']);\n }\n }\nRun Code Online (Sandbox Code Playgroud)\n\n简单,但是当我再次登录时,此事件ionViewDidEnter 和 ionViewWillEnter不会触发,我希望每次用户进入面板主页时都会触发此事件,这是我登录应用程序的代码
\n\nasync authenticationLogin() {\n const loading = await this.loadingController.create({\n message: 'Autenticando',\n });\n loading.present();\n\n const userModel: any = {\n afiliate_code: this.authForm.value.afiliate_code,\n device_uuid: this.device.uuid,\n };\n let companyCode: string = this.authForm.value.company_code;\n companyCode = companyCode.toUpperCase();\n\n this.auth.login(userModel, companyCode, …Run Code Online (Sandbox Code Playgroud) 在 Ionic 4 (Angular) 中,我想为项目的每个唯一“类型”属性创建一个 div,并在所述 div 下添加具有相同“类型”的所有元素。
例如,我想输出以下数组:
items = [
{
type: 'type1',
question: 'question1',
answer: 'answer1'
},
{
type: 'type2',
question: 'question2',
answer: 'answer2'
},
{
type: 'type2',
question: 'question3',
answer: 'answer3'
},
{
type: 'type3',
question: 'question4',
answer: 'answer4'
},
];
Run Code Online (Sandbox Code Playgroud)
像这样:
<div id="type1">
<div class="item">
<h1>question1</h1>
<div>answer1</div>
</div>
</div>
<div id="type2">
<div class="item">
<h1>question2</h1>
<div>answer2</div>
</div>
<div class="item">
<h1>question3</h1>
<div>answer3</div>
</div>
</div>
<div id="type3">
<div class="item">
<h1>question4</h1>
<div>answer4</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我在将虚拟滚动实现到我的 ionic 4 + Angular 项目中时遇到问题。
以前,我使用过 ionic 的虚拟滚动实现(ion-virtual-scroll),它最初工作得很好,但遇到了一个可以说是很大的警告,它不支持 ionic 的网格视图,这是我的应用程序所需的东西。(Ionic 已在其存储库中的“功能请求”下承认了这一点: https: //github.com/ionic-team/ionic/issues/16632)
与此同时,我求助于使用 ngx-virtual-scroller (https://github.com/rintoj/ngx-virtual-scroller),因为它提供了多列支持
但是,我在项目中使用时遇到了问题。
我已经通过 npm 安装了它(npm install ngx-virtual-scroller --save)并在我的 app.module 中导入了 VirtualScrollerMoudle
应用程序模块.ts
import { VirtualScrollerModule } from 'ngx-virtual-scroller'
imports: [
...
VirtualScrollerModule
],
Run Code Online (Sandbox Code Playgroud)
我已将虚拟滚动标签包裹在组件视图中的元素周围
产品卡视图.component.html
<virtual-scroller #scroll [items]="productsArray">
<div *ngIf="columnViewActive; else listView">
<ion-row>
<ion-col size="6" *ngFor="let p of scroll.viewPortItems">
<ion-card>
<ion-card-header>
<a class="productTitleColumn" title="{{ p.title }}" href="{{ p.link }}">{{ p.title }}</a>
</ion-card-header>
<ion-card-content>
..... ETC .....
</ion-card-content>
</ion-card>
</ion-col>
</ion-row>
</div> …Run Code Online (Sandbox Code Playgroud) 我iOS只想在一页中禁用而不是全局禁用,所以让 \xe2\x80\x99s 说用户结账并付款,我不希望用户在获得后返回到他所在的位置收据。我希望用户留在该页面而不能向后滑动,在 android 中我已经禁用了硬件按钮,而在iOS我有点挣扎。
我已经添加到app.module:
\n\nIonicModule.forRoot({ swipeBackEnabled: false })\nRun Code Online (Sandbox Code Playgroud)\n\n这会禁用全局向后滑动,这就是我不想要的,我也尝试过这个:
\n\n\n\n我跟着它,但仍然无法达到我想要的,
\n\n我也不明白用户最后说的话:
\n\n当前的实现仅适用于应用程序中的单个实例IonRouterInstance,但如果您在自己的应用程序中需要,可以通过支持其他实例来增强它。
他所说的“作品与单曲”是什么意思?
\n\n非常感谢,任何帮助将不胜感激。
\n我正在尝试使用 Visual Studio Code IDE 在我的 PC 中运行下载的离子模板,但当我尝试运行时出现以下错误npm install
> grpc@1.20.0 install C:\Users\Lenovo\Desktop\project\Template-Ionic\ionic-starter-master\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v72-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for grpc@1.20.0 and node@12.14.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version …Run Code Online (Sandbox Code Playgroud) ionic-framework ×10
angular ×7
ionic3 ×2
ionic4 ×2
typescript ×2
back ×1
css ×1
ionic-native ×1
ios ×1
node.js ×1
npm ×1
security ×1
swipe ×1