我正在尝试使用 Vue 3.2 中的动态组件开发选项卡,但组件没有显示。如果我更改<component :is=currentTab ></component>
为<A/>
,它就会出现,所以我认为<component></component>
工作不正常,但我不知道为什么。如果您能给我一些建议,我将不胜感激。谢谢。
<template>
<div class="flex-column">
<div class="header" >
<div id="dynamic-component-demo" class="demo">
<button
v-for="tab in tabs"
v-bind:key="tab"
v-bind:class="['tab-button', { active: currentTab === tab }]"
v-on:click="currentTab = tab"
>
{{ tab }}
</button>
<component :is=currentTab ></component>
</div>
</div>
</div>
<template>
Run Code Online (Sandbox Code Playgroud)
<script setup lang="ts">
import Shop from './A/A.vue';
import Knowledge from './B/B.vue';
import Community from './C/C.vue';
import router from '../../router';
const currentTab= ref('A');
const tabs = ['A', 'B', 'C']
</script>
Run Code Online (Sandbox Code Playgroud) 我想从 DOM 中“卸载一个简单的功能组件”。我搜索了很多,发现大多数教程都是基于类组件的,但我没有看到任何简单的示例。我的要求是单击按钮时从 DOM 中卸载功能组件。以下是带有按钮的组件,我喜欢在单击它时卸载它。希望有人可以帮助我做到这一点。提前致谢 !
import React from 'react'
function App() {
return (
<div className='app-component'>
<h2 className="h2">App Component</h2>
<button>Unmount This Component</button>
</div>
)
}
export default App
Run Code Online (Sandbox Code Playgroud) 我正在使用 Angular 14。我有一个独立组件,我想在其中包含另一个模块的子组件。独立组件看起来像
<div>
<child-component></child-component>
</div>
Run Code Online (Sandbox Code Playgroud)
它的服务文件是
@Component({
selector: 'my-parent-component',
templateUrl: './parent.component.html',
standalone: true,
imports: [
MyModule
]
})
export class ParentComponent {
...
}
Run Code Online (Sandbox Code Playgroud)
子组件位于另一个模块中——MyModule。my.module.ts 文件看起来像
/* imports */
@NgModule({
declarations: [
ChildComponent
],
imports: [
...
]
})
export class MyModule {
constructor(entityDefinitionService: EntityDefinitionService) {
...
}
}
Run Code Online (Sandbox Code Playgroud)
但我父母的 HTML 给了我错误
<child-component></child-component>
Run Code Online (Sandbox Code Playgroud)
线 ...
'app-child-component' is not a known element:
1. If 'app-child-component' is an Angular component, then verify that it is included in the '@Component.imports' of this …
Run Code Online (Sandbox Code Playgroud) 我需要Java Swing Free Memory组件(类似于Eclipse IDE中的组件).优选地是免费的(和开源的).先感谢您.
我几年前完成了一个项目.现在我想改进它.因此,我安装之前在项目中使用的组件.但是,当我运行该项目时,它会出错.编译器找不到某些组件对象的dcu文件.我该如何解决?
我正在整理一个大型遗留项目中使用的组件,我已经淘汰了220个自定义组件中的大约90个,用标准的Delphi控件替换它们.其余一些组件需要大量工作才能删除我无法使用的组件.我想阻止任何人额外使用其中一些组件,并想知道是否有一种方法可以在设计时将组件放在表单上显示消息 - 例如"不要使用此控件,请使用改为x或y".
另一种可能性是隐藏组件托盘上的控件(但在设计时仍然可以在窗体上正确呈现控件).
我无法清楚地弄清楚 vue 路由器中 params 和 query 之间的区别。我最近遇到一个案例,让我很困惑。有页面A和页面B,我想从页面A路由到页面B,页面B使用动态路由(例如'/user/:id/:age/:address')并且数据来自params对象(get id, age, address from params),当我重新加载页面 B 时,它失败并抛出 404 not found (cannont get /user/1/24/xxxstreet)。如果我使用查询而不是参数(例如'/user?id=1&age=24&address=xxxstreet'),我可以重新加载页面。那么有人可以帮我弄清楚vue路由器中params和query之间的区别吗?
如何验证Textinput的正确性?我想使用自定义窗体验证以及验证后文本组件中的显示错误来正确验证窗体,但是如何?拜托,伙计们给我看个例子!
我在下面有这个函数使用ComponetCount,当我在另一个Form中使用这个函数时,它在Form1中,在Form1中使用Form2,它带来了Form1而不是Form2的Componetes数量,我该如何解决这个问题问题?遵循功能:
function Form1.getgridId(KeyField: String): string;
var
i: Integer;
id: string;
begin
for i := 0 to ComponentCount -1 do
begin
if Components[i] is TCustomDBGrid then
id:= TCustomDBGrid(Components[i]).DataSource.DataSet.FieldByName(KeyField).AsString;
end;
Result := id;
end;
Run Code Online (Sandbox Code Playgroud)
ANS(在我的具体案例中) - 在所有人的帮助下:
function getgridId(KeyField: String): string;
var
i: Integer;
id: string;
begin
for i := 0 to Screen.ActiveForm.ComponentCount -1 do
begin
if Screen.ActiveForm.Components[i] is TCustomDBGrid then
id := TCustomDBGrid(Screen.ActiveForm.Components[i]).DataSource.DataSet.FieldByName(KeyField).AsString;
end;
Result := id;
end;
Run Code Online (Sandbox Code Playgroud) 我正在考虑使用 Angular CLI 学习 Angular 8。
我向核心模块添加了两个新组件,然后将其导入应用程序模块。
当我尝试在我的应用程序 html 中呈现组件时,控制台中会抛出“未知元素”错误。
我不确定为什么?
这是我的 app.module.ts
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { AppComponent } from "./app.component";
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { CoreModule } from "./core/core.module";
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, NoopAnimationsModule, CoreModule],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)
我的 core.module.ts
import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { InputComponent } from "../input/input.component";
import …
Run Code Online (Sandbox Code Playgroud) 请提供步骤将Joomla 1.5组件更新为Joomla 2.5组件.
先感谢您.
我将把这个程序分配到OnMouseEnter
.我有一些TImage
会改变它的图片OnMouseEnter
.在事件处理程序上更容易制作它的每个过程.但我不想重复相同的代码.
var
i: Integer;
CoName: TComponent;
png: TPngImage;
s: string;
begin
s := '';
for i := 1 to 16 do
begin
CoName := Form1.Components[i];
if CoName is TImage then
begin
s := CoName.Name;
Break;
end;
end;
if Trim(s) <> '' then
begin
png := TPngImage.Create;
try
png.LoadFromResourceName(hInstance, 'ResImgA');
// s.picture.Assign(png); > i can not do this
finally
FreeAndNil(png);
end;
end;
end;
Run Code Online (Sandbox Code Playgroud)
我怎么能s
进入TImage.Name
?
我有一个使用Raize Components的Delphi项目的源代码(不幸的是,我不确定它的开发版本)。Raize Components被Embarcadero收购,并更名为Konopka Signature VCL Controls。因此,由于Raize不再可用,因此我无法编译该项目的源代码。
我认为最好的解决方案是将Raize换成较新的Konopka,但是我不确定如何做到这一点。Konopka是否包含在Delphi中?它是免费版吗?我可以单独购买以与免费版一起使用吗?最后,一旦我拥有Konopka,切换Raize控件将是一个简单的过程吗?
components ×13
delphi ×5
angular ×2
javascript ×2
vue.js ×2
angular-cli ×1
angular14 ×1
class ×1
dcu ×1
forms ×1
java ×1
joomla ×1
joomla2.5 ×1
module ×1
php ×1
react-native ×1
reactjs ×1
swing ×1
textinput ×1
timage ×1
unmount ×1
upgrade ×1
validation ×1
vue-router ×1
vuejs3 ×1