material-design4 相关问题


无法在 Material UI 日期选择器上显示错误和错误消息

我正在使用 React Material UI 我想在后端计算的某些条件下显示错误。 我使用了 Material UI-datepicker 但无法显示错误 从 'react' 导入 * as React; 导入


Angular Material v17:缺少“MatFormFieldAppearance”中的“遗产”

在 Angular Material v14 中,MatFormFieldAppearance 提供了传统、标准、填充和轮廓值。 类型 MatFormFieldAppearance = '旧版' | '标准' | '填充' | '大纲'; 然而,在 Angular


无法解决依赖关系:来自@material-ui/[email protected]的peer React@"^16.8.0 || ^17.0.0"

我使用创建了一个反应项目 npm 初始化 -y npm 安装 React React-dom 然后我尝试安装 Material UI npm 安装@material-ui/core 它得到错误 npm 错误!代码 ERESOLVE npm 错误!解决...


Angular Material 5 深色主题未应用于机身

我创建了一个“自定义”主题(使用 https://material.angular.io/guide/theming 上的主题文档,这非常糟糕),如下所示: @import '~@angular/material/theming'; @包括 mat-cor...


React Material 选项卡方向在响应式中发生变化?

如何更改响应式材质选项卡方向变化?我正在使用 React Material 版本 4 我需要桌面响应式的orientation=“horizontal”,它应该是orientation=“


@types/material-ui 和官方的@mui/types 包有什么区别?

npm 包:@types/material-ui 和 @mui/types 我知道前者受到 Definely Typed 社区的支持,但如果存在官方类型包,为什么它首先存在呢?我已经


从 Material UI Modal 中删除边框

我正在尝试使用 React Material UI 模态,但当它聚焦时,我总是在模态周围看到黑色边框。当它失焦时我已经删除了边框,但是如果模态聚焦......


如何在 Angular Material 2 中构建自定义组件

是否有任何标准方法可以在 Angular Material 2 之上构建自己的组件或扩展现有组件。 之前我使用过 Sencha/ExtJS 框架,构建自己的框架非常简单


有没有办法使用角度材料拖放来调整大小

我正在使用 Angular 和 Material 创建一个 Web 应用程序,我希望能够拖放和调整我的部分的大小。有没有办法使用 Angular Material 拖放 CDK 来完成?


将 Angular Material 从 16 迁移到 17 时出现目录错误

我正在尝试运行 Angular Material 迁移工具以从 16 迁移到 17,但收到一条错误消息,指出目录必须是字符串。 JSON 显示它是错误的。这不是提示,a...


如何用React Material UI实现多行标签

我正在使用 React js 来开发我的 Web 应用程序,并且我正在使用 React 材料设计来进行 UI 设计。下面是我引用的网址。 https://material-ui-next.com/ 我正在努力实现一些目标...


在 React 16 中使用 RTL 测试 Material UI Drawer 的关闭逃逸功能

我正在尝试测试 Material UI Drawer。当您按 Esc 键或单击抽屉外部时,它应该关闭。但它正在失败。 我正在使用反应测试库进行测试。我创建了一个


Angular Material 6 网格列表对齐项目并将内容对齐到 flex-start

我正在尝试使用 Angular Material 6 动态网格列表。与文档相关的示例将网格的内容放在每个图块的中心。请参阅此处的示例 我想要内容进去...


react-testing-library:无法关闭 MUI Select 的下拉菜单

我有一个 SelectExample.js 从“react”导入 React, { useState }; 从“@mui/material”导入{InputLabel、MenuItem、FormControl、Select、Typography };> 导出默认fu...


MatFormFieldModule / MatLegacyFormFieldModule 未导入 MatInputFieldModule 时发生冲突

我必须在客户端项目中使用 Material Legacy 模块。 现在,我使用 MatLegacyFormFieldModule 和 MatLegacyInputFieldModule 删除了所有出现的 MatFormFieldModule 和 MatInputFieldModule。


为什么 Jetpack Compose Material 3 Card 可组合项的内容需要 ColumnScope?

我正在使用 Jetpack Compose,最近注意到 androidx.compose.material3 包中的 Card 可组合项要求其内容在 ColumnScope 中提供。具体来说,


如何使用带有 Material UI 图标的样式化组件

我尝试使用覆盖“!”但这仍然不起作用,有没有办法设计它?我在网上到处查看都无济于事。 从“反应”导入反应; 从 'styled-


如何使用 Angular 服务创建 nx 库

我有几个 Angular 应用程序在 nx 工作区中运行。所有这些应用程序都使用 Angular Material 对话框。为此,我通常创建这样的 Angular 服务: 导入 { 管理组件 }


类型“IntrinsicAttributes & RefAttributes<any>”上不存在属性“XXX”

我将编码作为一种爱好,并且正在使用 TypeScript 构建一个 React 网站。我找到了一个免费的 Material UI 模板,我正在尝试将其集成到现有代码中。模板是用


Angular Material 17 独立组件中没有 DateAdapter 的提供者

我有一个带有 Angular 17 应用程序的 nx 项目,并尝试使用带有材料 17.0.4 的 Angular 材料日期选择器。但我明白了 NullInjectorError:没有 DateAdapter 的提供者! 错误。组件...


具有多个React版本和CSS隔离的模块联合

我有一个模块联合远程存储库,它是: 使用 React 17 构建 Material-ui 4 包括 jss 有来自第三方库的自己的全局 CSS,我无法编辑 我有多个主机...


Angular Material 浮动标签在悬停时消失或被切断

如果不需要的话,我不想禁用浮动标签,但它们对我来说表现不佳。当我将鼠标悬停在它们上方时,很多时候浮动标签会完全消失......


材质 UI 输入与只读视图的文本字段

我正在努力构建一个新的 Material UI 表单。我想知道是否有只读字段的首选组件。我正在比较输入和文本字段组件,但无法真正分辨出什么......


为什么BottomSheet的背景颜色与Flutter中Material 3中设置的颜色不一样?

我正在使用材质 3 并打开 BottomSheet,如下所示: 显示ModalBottomSheet( 上下文:上下文, 背景颜色:颜色.白色, ... 然而,背景并不是 100% 白色 - 它看起来像......


如何在 Material-ui 表中添加垂直列分隔线

我创建了一个给定高度的桌子(比如说70vh)。我想要一个垂直的列分隔线来覆盖桌子的整个高度。我可以使用 TableCell 的 CSS 添加它。但我想要垂直列分割...


如何在 Material Design 3 中使用自定义颜色?

昨天我将我的应用程序从 MD2 升级到 MD3,一切正常。但我还是不太明白MD3中的自定义颜色。 问题 我什么时候应该使用自定义颜色?真正的我们是什么...


如何在材料UI日期选择器反应中仅获取日期?

我使用 Material-UI 选择器库来获取日期 我只想知道日期 像这样 17/07/2021 但我得到了这样的日期和时间 2021 年 7 月 17 日星期六 12:21:00 const [获取日期,


如何将下拉面板放置在 mat-select 文本框的正下方

我正在使用 Angular Material 14.0.4 和 Angular 15.1.3。 我有一个垫选择下拉菜单,是这样写的...... 我正在使用 Angular Material 14.0.4 和 Angular 15.1.3。 我有一个mat-select下拉菜单,是这样写的... <mat-select value="5" panelClass="custom-panel"> <mat-option value="5">5</mat-option> <mat-option value="10">10</mat-option> <mat-option value="20">20</mat-option> </mat-select> 在此我应用了panelClass及其CSS代码如下... .custom-panel { top: calc(100% + 10px) !important; } 而且仍然如下。下拉列表与其文本框重叠 这是未选中时的下拉菜单 这是选择后的下拉菜单 如何将面板放置在选择文本框的正下方... 您可以使用下面的CSS来做到这一点! 我们使用csstransform将面板移动到底部! .custom-panel { transform: translateY(25px) !important; } 堆栈闪电战


选中/取消选中 mat-checkbox 未正确返回 true 或 false

我正在使用 Angular 15 和 Angular Material 14,下面是我用来显示复选框列表的 HTML 代码 我正在 Angular 15 和 Angular Material 14 工作,下面是我用来显示复选框列表的 HTML 代码 <div *ngFor="let control of checkboxArray.controls;let i = index" > <mat-checkbox [formControl]="control" (input)="validateInputs(notificationForm)" [checked]="control.value" (change)="control.checked=$event.checked;onCheckedChange(i);"> {{ checkboxItems[i].name }} </mat-checkbox> </div> 下面是Angular中onCheckedChange函数的代码 onCheckedChange(index: number) { this.sortCheckboxArray(); const checkboxItem = this.checkboxItems[index]; const control = this.checkboxArray.at(index); if (control) { if (control.value) { this.lists.push(checkboxItem.id.toString()); } else { this.lists.pop(checkboxItem.id.toString()); } } this.updateSubscriberGroupsCount(); this.cdr.detectChanges(); } 当我选中复选框时,在这个 onCheckedChange 函数中,control.value 始终返回 false。哪里出了问题?无法理解.. 这是一个工作版本,复选框逻辑工作正常,希望有帮助! 我们需要使用control.value获取表单组,但我们还需要访问内部表单控件,然后获取复选框值! import { CommonModule } from '@angular/common'; import { Component } from '@angular/core'; import { FormArray, FormControl, FormGroup, ReactiveFormsModule, } from '@angular/forms'; import { bootstrapApplication } from '@angular/platform-browser'; import 'zone.js'; import { MatCheckboxModule } from '@angular/material/checkbox'; @Component({ selector: 'app-root', standalone: true, imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule], template: ` <form [formGroup]="form"> <div formArrayName="array"> <div *ngFor="let control of checkboxArray.controls;let i = index" [formGroupName]="i"> <mat-checkbox formControlName="test" style="margin-bottom: 15px;" (change)="onCheckedChange(i);"> {{ checkboxItems[i].name }} </mat-checkbox> </div> </div> </form> `, }) export class App { name = 'Angular'; form = new FormGroup({ array: new FormArray([]), }); lists = []; checkboxItems: any = []; ngOnInit() { this.add(); this.add(); this.add(); } add() { this.checkboxArray.push( new FormGroup({ test: new FormControl(false), }) ); this.checkboxItems.push({ name: 'test' }); } get checkboxArray() { return this.form.get('array') as FormArray; } onCheckedChange(index: number) { // this.sortCheckboxArray(); // const checkboxItem = this.checkboxItems[index]; const control = this.checkboxArray.at(index); if (control) { if (control.value.test) { console.log('checked'); // this.lists.push(checkboxItem.id.toString()); } else { console.log('not checked'); // this.lists.pop(checkboxItem.id.toString()); } } // this.updateSubscriberGroupsCount(); // this.cdr.detectChanges(); } } bootstrapApplication(App); 堆栈闪电战


更改垫输入的波纹颜色

我现在一直在努力了解如何手动更改元素的波纹颜色,但我似乎无法让它以任何方式工作。 我现在一直在努力研究如何手动更改 <mat-input> 元素的波纹颜色,但我似乎无法让它以任何方式工作。 <input matInput type="number" (keydown)="updateManualPage(1)" placeholder="Filter" formControlName="filterParam1"> 我已经尝试了CSS中我能想到的一切,.mat-form-field-underline,.mat-form-field-ripple,包括我使用::after和::before选择器从另一个SO问题/答案中无耻地撕掉的一大块类,尝试使用 ::ng-deep、!important,但似乎没有任何东西可以改变从 @import "../node_modules/@angular/material/prebuilt-themes/indigo-pink.css"; 导入的蓝色波纹的颜色 编辑:只需更好地阅读 API,所以我发现波纹后出现的边框颜色来自 <mat-form-field> 元素,该元素有一个颜色选择器。但是,该颜色选择器只能具有“primary”、“accent”和“warn”值。所以现在我想知道如何插入自定义颜色。 设法弄清楚了,原来如此 ::ng-deep .mdc-text-field--filled:not(.mdc-text-field--disabled) .mdc-line-ripple::after { border-bottom-color: *X* !important; }


为什么我的全景切换按钮不起作用?

我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户观看 360 度全景图时,按钮不应旋转。 我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户查看 360 度全景图时,按钮不应旋转。 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>panoramas</title> <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script> <style> #switchButton { cursor: pointer; } </style> </head> <body> <a-scene> <a-assets> <img id="panorama1" src="1.jpg"> <img id="panorama2" src="2.jpg"> </a-assets> <a-sky id="panorama" src="#panorama1" rotation="0 -130 0"></a-sky> <a-entity id="cameraRig"> <a-camera></a-camera> </a-entity> <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#CCC" id="switchButton"></a-plane> </a-scene> <script> const button = document.querySelector('#switchButton'); let currentPanorama = 1; button.addEventListener('mouseenter', () => { const panorama = document.querySelector('#panorama'); if (currentPanorama === 1) { panorama.setAttribute('src', '#panorama2'); currentPanorama = 2; } else { panorama.setAttribute('src', '#panorama1'); currentPanorama = 1; } }); </script> </body> </html> 我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户查看 360 度全景图时,按钮不应旋转。 我解决你的问题 您需要做的是添加一个光标来处理 onlcick 事件,这是唯一的方法。 <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width"> <title>A-Frame HTML Shader - Dynamic</title> <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> <script src="https://unpkg.com/[email protected]/dist/aframe-html-shader.min.js"></script> <script> let currentPanorama = 1; AFRAME.registerComponent("click-log", { init: function () { this.myFunction = function () { const panorama = document.querySelector('#panorama'); if (currentPanorama === 1) { panorama.setAttribute('src', '#panorama2'); currentPanorama = 2; } else { panorama.setAttribute('src', '#panorama1'); currentPanorama = 1; } }; this.el.addEventListener("click", this.myFunction); }, remove: function () { this.el.removeEventListener("click", this.myFunction); } }); </script> </head> <body> <a-scene update-html> <a-camera> <a-cursor material="color: red"></a-cursor> </a-camera> <a-assets> <img id="panorama1" src="https://l13.alamy.com/360/PWNBM9/testing-new-cameralens-combination-in-my-garden-in-aarhus-denmark-PWNBM9.jpg"> <img id="panorama2" src="https://aframe.io/aframe/examples/boilerplate/panorama/puydesancy.jpg"> </a-assets> <a-sky id="panorama" src="#panorama1" rotation="0 -130 0"></a-sky> <a-entity id="cameraRig"> <a-camera></a-camera> </a-entity> <a-plane click-log position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#CCC" id="switchButton"></a-plane> </a-scene> </body> </html>


Angular Material 2:修复多行错误消息

我在我的角度应用程序中使用角度材料2。当我的表单输入字段错误消息超过一行时,我遇到了问题。这是照片: 这是代码: 我在我的角度应用程序中使用角度材料 2。当我的表单输入字段错误消息超过一行时,我遇到了问题。这是照片: 这是代码: <md-error *ngIf="password.touched && password.invalid"> <span *ngIf="password.errors.required"> {{'PASSWORD_RECOVERY.FIELD_REQUIRED' | translate}} </span> <span *ngIf="password.errors.minlength || password.errors.maxlength"> {{'PASSWORD_RECOVERY.PASSWORD_LENGTH' | translate}} </span> <span *ngIf="password.errors.pattern"> {{'PASSWORD_RECOVERY.FOR_A_SECURE_PASSWORD' | translate}} </span> </md-error> 我通过阅读 github 了解到,这是 Angular 2 材料中的一个错误。有人通过自定义解决方法成功解决了这个问题吗? 问题是类为 .mat-form-field-subscript-wrapper 的元素是 position: absolute,所以它不占用实际空间。 按照 xumepadismal 在 github 上关于此问题的建议,您可以添加此 scss 作为解决我的问题的解决方法: // Workaround for https://github.com/angular/material2/issues/4580. mat-form-field .mat-form-field { &-underline { position: relative; bottom: auto; } &-subscript-wrapper { position: static; } } 它会转换静态 div 中的 .mat-form-field-subscript-wrapper 节点,并将 .mat-form-field-unterline 重新定位在输入字段之后。 正如材料 15 中在 github 讨论中提到的,可以通过将 subscriptSizing="dynamic" 添加到 mat-form-field 来解决问题。 要更改默认行为,您必须使用以下选项更新 angular.module.ts 提供程序: providers: [ { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { subscriptSizing: 'dynamic' } } ] 这也可以在材料文档中找到 使用@mattia.corci提出的解决方案会导致错误消息被推到底部太多,从而在顶部留下不必要的空白空间。 使用 Tailwind CSS,这个解决方案对我来说适用于最新的 Angular 17: .mat-mdc-form-field { @apply w-full self-start; .mat-mdc-form-field-subscript-wrapper { @apply flex; .mat-mdc-form-field-error-wrapper { @apply static; } } } mat-form-field.ng-invalid.ng-touched { animation: example; animation-duration: 0.3s; margin-bottom: 20px; } @keyframes example { from { margin-bottom: 0; } to { margin-bottom: 20px; } } 它对我有用。


© www.soinside.com 2019 - 2024. All rights reserved.