components 相关问题

统一建模语言中的一个组件“代表系统的模块化部分,它封装了其内容,其表现形式可在其环境中替换。组件根据提供的和所需的接口定义其行为”。组件的最佳示例可以在ActionScript-Flash,Flex sdks中找到。你有UI组件,如按钮,标签,DataGrids,可重复使用的图表,可分发等。

在Vue3的文档中,有一句话不是很懂,也没有具体的例子来解释

https://vuejs.org/guide/components/events.html#declaring-emitted-events 如果在 emits 选项中定义了本机事件(例如,点击),监听器现在将只监听组件发出的点击

回答 1 投票 0

单个页面上的 Angular 多组件通信

我在一页上并排放置了两张材料卡: 错误.component.html 我在一页中并排放置了两张材料卡: error.component.html <mat-card-content><app-errortitle></app-errortitle></mat-card-content> <mat-card-content><app-errorcount></app-errorcount></mat-card-content> 我正在尝试学习如何让 errorcount 识别用户何时从 errortitle 中选择一个项目来刷新 errorcount——没有我奇妙的“刷新按钮”解决方案。 errortitle.component.hmtl <div *ngFor="let errorlist of errorList"> <mat-card style="cursor:pointer;" (click)="toggleErrorCount(errorlist.id)"> <mat-card-title>{{errorlist.title}}</mat-card-title> <mat-card-content>{{errorlist.description}}</mat-card-content> </mat-card><br /> </div> errortitlecomponent.ts import { Component, OnInit } from '@angular/core'; import { ErrorcountComponent } from '../errorcount/errorcount.component' export interface ErrorList { id: number, title: string, description: string }; @Component({ providers: [ErrorcountComponent], selector: 'app-errortitle', templateUrl: './errortitle.component.html', styleUrls: ['./errortitle.component.css'] }) export class ErrortitleComponent implements OnInit { errorList: ErrorList[] = [ { id: 1, title: 'Application Error', description:'Problems caused by malfunction in code.' }, { id: 2, title: 'Unexpected Server Error', description: 'Interruptions caused by equipment.' }, { id: 3, title: 'Service Error', description: 'Exceptions caused by malfunctions in APIs.' }, { id: 4, title: 'Angular Error', description: 'Psycotic depresion that needs to call things 3x to make sure it works?' } ]; constructor(private errcountcomponent: ErrorcountComponent) { } ngOnInit(): void { } toggleErrorCount(id: number) { /*Ilogical Operation*/ this.errcountcomponent.error_id = id; /*this.errcountcomponent.fileterErrorCounter();*/ } } errorcount.component.html <table width="100%"> <thead> <tr> <th>Date</th> <th>Count</th> </tr> </thead> <tr *ngFor="let errorcounter of fileterErrorCounter()"> <td>{{errorcounter.date}}</td> <td style="text-align:right;">{{errorcounter.count}}</td> </tr> </table> errorcount.component.ts import { Component, Input, OnInit } from '@angular/core'; export interface ErrorCounter { id: number, error_id: number, date: string, count: number }; @Component({ selector: 'app-errorcount', templateUrl: './errorcount.component.html', styleUrls: ['./errorcount.component.css'] }) export class ErrorcountComponent implements OnInit { @Input() error_id: number = 0; errorCounter: ErrorCounter[] = [ { id: 1, error_id: 1, date: '20230101', count:201 }, { id: 2, error_id: 2, date: '20230102', count:321 }, { id: 3, error_id: 3, date: '20230103', count:431 }, { id: 4, error_id: 1, date: '20230104', count:541 }, { id: 5, error_id: 2, date: '20230105', count:651 }, { id: 6, error_id: 3, date: '20230106', count:561 }, { id: 7, error_id: 1, date: '20230107', count:471 }, { id: 8, error_id: 2, date: '20230108', count:381 }, { id: 9, error_id: 3, date: '20230109', count: 282 }, { id: 10, error_id: 1, date: '20230110', count: 184 }, ]; constructor() { } ngOnInit(): void { } fileterErrorCounter(): ErrorCounter[] { alert(this.error_id); if (this.error_id > 0) return this.errorCounter.filter(f => f.error_id == this.error_id) else return this.errorCounter; } } 在我看来:errortitle.component.hmtl 有一个 (click)="toggleErrorCount(errorlist.id)" 它应该使用它的 import { ErrorcountComponent } 中的内容来更改 @Input() error_id 的值:errorcount.component 中的数字.ts 并最终调用它的 fileterErrorCounter()——唯一的问题是调试在 countercomponent 处停了三次——第一次有值但其余的都清零了——我认为刷新永远不会发生。 我不确定这是否是在 Angular 上处理这个问题的方法,或者我是否需要某个地方的可观察对象,或者 @ViewChild,或者将其中任何一个放在哪里。我卡住了。 请在从 errortitle.component 中选择一个项目后帮助归档 errorcounter.component 的内容,而无需进行令人讨厌的刷新。 谢谢

回答 0 投票 0

导航栏组件未显示在网页上

我的 Navbar 组件没有出现在我的 React 网页上……这是代码: 这是我的反应代码:

回答 0 投票 0

react-virtualized 表列中的下拉渲染溢出

我正在开发一个 React 应用程序,我正在渲染一个表格,其中 2 个列字段而不是包含文本包含一个下拉菜单,我在这些下拉菜单中有不同的选项,dropd ...

回答 1 投票 0

如何从位于后端的文件中向不同的组件添加不同的字体?

我正在使用 NextJS (13) 和 Sanity 创建带有类型测试器(测试字体)的网页。 我有多种字体,每种字体都有一个组件。在这个组件中,我使用了一个 contentedibl ...

回答 0 投票 0

Symfony sensio/framework-extra-bundle 被放弃了,#[Security] 替代品是什么?

我看到“package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.” 但我在我的控制器中使用它: 使用 Sensio\Bundle\FrameworkExtraBundle\Configur...

回答 1 投票 0

ReactJs 将道具从好孩子传递给父母

大家好。 所以我想重置密码,这就是流程。当用户单击重置密码模态时,将显示一个新的模态屏幕,用于输入电子邮件,当用户输入电子...

回答 0 投票 0

创建组件更新控件的全局属性

我有一组组件,它们共享一些全局变量来控制公共属性,例如风格特点。 这些当前通过全局类在运行时访问,例如MyCompsSettings().

回答 1 投票 0

如何更改 antd 表格标题颜色

我尝试将基类作为目标,如下所示,但这是行不通的。 .ant-table .ant-table-container .ant-table-content table thead.ant-table-thead { 背景色:绿色!重要; } 有没有工作...

回答 3 投票 0

没有模板的组件

我有一些代码可以对服务器进行 api 调用并返回一些 JSON。 它确实作为一种方法存在于我的组件中,但由于它有点长,我想将它提取到它自己的文件中 在...

回答 2 投票 0

在@Component类中使用实例变量来保存Spring Boot应用程序中的临时值

在Spring boot应用中是否可以使用Instance Variable来临时保存,让其他请求可以使用? 我们可以像下面这样创建一个组件类吗,下面有什么复杂的吗……

回答 0 投票 0

查找与应用程序相关的所有文件和文件夹 (Mac)

有没有一种方法(或应用程序)可以显示或列出与特定应用程序相关的所有文件和文件夹(无论位置如何,即图书馆或其他地方)?这类似于卸载程序的方式(

回答 0 投票 0

带有应用程序标识符的条码 EAN 128 的 Flex 条码组件

我正在寻找一个 flex 组件来生成类似于下面的条形码。 见图片 http://img.skitch.com/20100716-g4456feuw8af1b1q6i1p2kj3tt.jpg 我在 flex2 找到了一个类似的插件...

回答 1 投票 0

Unreal Engine - Pointer 和 Component 的关系

为什么我们必须使用指针,当我们声明一个像 USceneComponent 或 UStaticMeshComponent 这样的组件时?为什么 unreal engine 不接受 opposite ?? 我知道 UObject 派生类不能

回答 1 投票 0

类组件怎么变成函数组件?

有谁知道如何将类组件更改为功能组件? 我刚刚在 REACT 中学习了“功能组件”,我很难将类组件转换为

回答 1 投票 0

我如何解决我的github身份验证。我试图将代码推送到我的 github 存储库

我如何解决我的github身份验证。我试图将代码推送到我的 github 存储库,但收到此错误消息 em@Abiodun-ADEDAPO-abeyjoe:~/Desktop/上传到 github/abeyjoe$ git push -u

回答 0 投票 0

在 React.js 中,有没有办法为所有子组件提供特定的道具?

感谢您看到这个问题,也感谢您对这个问题的思考。 我正在寻找为 React.js 中的整个子组件提供特定道具的方法 我知道在

回答 1 投票 0

React 和地图功能

所以我有两个组件 导航栏组件 和导航链接组件 我正在尝试将导航链接名称作为道具从导航栏组件传递到导航链接组件 而且我不明白为什么我要保留

回答 2 投票 0

如何在 React 中制作可重用的导航栏组件?

最近在尝试做一个react网站。我的主页组件在下面。我的项目中有很多页面。我仍然是 reactjs 的新手。我需要知道如何制作可重复使用的导航栏

回答 1 投票 0

Next.js: Select element must have a accessible name: Element has no title attribute

Next.js 和 Typescript 初学者。我正在使用 Next.js 重建一个应用程序,但在拆分页面和组件时遇到了问题,并出现错误 Select element must have an accessible name: Element has...

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.