- 没多少逻辑,就直接贴代码了
- 下面是html模板的代码:
import { Component, TemplateRef } from '@angular/core';import { FormsModule } from '@angular/forms';import { NzDropdownContextComponent, NzDropdownService } from 'ng-zorro-antd';@Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css']})export class AppComponent { constructor( private dropdownService:NzDropdownService ){} dropdown:NzDropdownContextComponent; contextMenu($event:MouseEvent,template:TemplateRef ){ this.dropdown=this.dropdownService.create($event,template); } openRenameListModal(){ console.log("打开了重命名modal"); } close(){ this.dropdown.close(); } delete(){ console.log("删除了一个元素"); }}