我将按钮添加到元素,如下所示。
(this.sample as any).element.addEventListener("mouseover", function (e) {
if ((e.target as HTMLElement).classList.contains("e-rowcell")) {
let ele: Element = e.target as Element;
let row = parentsUntil(ele, "e-row");
this.row = row;
row.lastChild.appendChild(this.button);
row.lastChild.appendChild(this.button1);
}
}.bind(this));
我想在鼠标离开时删除按钮 请让我知道该怎么做? 见下面的截图
请参见下面的stackblitz链接 Sample Link
答案 0 :(得分:1)
删除您在“ mouseover”事件中添加的最后一个元素, 我在mouseover事件之后添加了内部加载方法。
this.gridInstance.element.addEventListener("mouseleave", function(e){
console.log(this.lastRow.lastChild.lastChild.remove());
}.bind(this))
我已经测试过了。
答案 1 :(得分:0)
默认情况下,您可以在HTML中使用按钮,并在CSS中显示/隐藏它们。
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}\src\main\resources\api.yml</inputSpec>
<modelPackage>com.demo.model</modelPackage>
<apiPackage>com.demo.api</apiPackage>
<generatorName>spring</generatorName>
<supportingFilesToGenerate>ApiUtil.java</supportingFilesToGenerate>
<generateApi>True</generateApi>
<generateApiTests>True</generateApiTests>
<generateModelTests>True</generateModelTests>
<validateSpec>true</validateSpec>
<configOptions>
<delegatePattern>true</delegatePattern>
<title>swagger-codegen-demo</title>
</configOptions>
</configuration>
</execution>
</executions>