以下是一个使用Angular 7创建响应式下拉菜单的示例:
import { Component } from '@angular/core';
@Component({
selector: 'app-dropdown',
templateUrl: './dropdown.component.html',
styleUrls: ['./dropdown.component.css']
})
export class DropdownComponent {
options = ['Option 1', 'Option 2', 'Option 3'];
selectedOption: string;
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { DropdownComponent } from './dropdown.component';
@NgModule({
imports: [BrowserModule, FormsModule],
declarations: [DropdownComponent],
bootstrap: [DropdownComponent]
})
export class AppModule { }
这样就创建了一个基本的Angular 7响应式下拉菜单。你可以根据自己的需要进行样式和功能的定制。