Angular 4+简洁的工具提示组件

Angular 4+简洁的工具提示组件
插件名称 tooltip
发布时间 2020年7月18日
插件作者 cloukit

Angular 4+应用程序创建的简单,简洁的工具提示组件。

安装:

# NPM
$ npm install @cloukit/tooltip --save

用法:

在您的module.ts中:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CloukitDropoutModule } from '@cloukit/dropout';
import { CloukitThemeModule } from '@cloukit/theme';
import { CloukitTooltipModule } from '../index';
import { DemoComponent } from './demo.component';

@NgModule({
  declarations: [ DemoComponent ],
  exports: [ DemoComponent ],
  imports: [
    CommonModule,
    CloukitThemeModule,
    CloukitTooltipModule,
    CloukitDropoutModule,
  ],
  providers: [ ],
  bootstrap: [ ]
})
export class DemoModule {}

在您的html中。

<cloukit-dropout-outlet></cloukit-dropout-outlet>
<div style="padding:60px;">

  <span class="label">tooltip提示在左边:</span>
  <span
    class="tooltipTrigger"
    cloukitTooltip="delicious german sausage"
    cloukitTooltipPlacement="left"
  >Bratwurst</span>
  <br><br>
  <span class="label">tooltip提示在右边:</span>
  <span
    class="tooltipTrigger"
    cloukitTooltip="delicious german sausage"
    cloukitTooltipPlacement="right"
  >Bratwurst</span>
  <br><br>
  <span class="label">tooltip提示到顶部:</span>
  <span
    class="tooltipTrigger"
    cloukitTooltip="delicious german sausage"
    cloukitTooltipPlacement="top"
  >Bratwurst</span>
  <br><br>
  <span class="label">tooltip提示到底部:</span>
  <span
    class="tooltipTrigger"
    cloukitTooltip="delicious german sausage"
    cloukitTooltipPlacement="bottom"
  >Bratwurst</span>
  <br><br>
  <span class="label">按钮上的tooltip提示:</span>
  <button
    class="tooltipTrigger"
    cloukitTooltip="delicious german sausage"
    cloukitTooltipPlacement="bottom"
  >Bratwurst</button>
  <br><br>
  <span class="label">tooltip提示在一个buton与点击动作:</span>
  <a
    href="#"
    class="tooltipTrigger"
    cloukitTooltip="delicious german sausage"
    cloukitTooltipPlacement="bottom"
    (click)="counter=counter+1"
  >Bratwurst {{counter}}</a>
</div>

在您的component.ts中。

import { Component } from '@angular/core';

@Component({
  selector: 'demo',
  templateUrl: './demo.component.html',
  styles: [
    '.tooltipTrigger { color:#710ECC; cursor: help; }',
    '.label { display:inline-block; width:250px; }',
  ],
})
export class DemoComponent {
  counter = 0;
}