提示

工具提示由Wijmo内核提供。 它们不是控件,而是鼠标悬停在指定元素上时显示的包含HTML的弹出窗口.

您可以使用 Tooltip.setTooltip 方法将工具提示与页面上的一个或多个元素相关联.

而这个段落有一个 span with a tooltip 和另一个 span with a different tooltip.

下面的按钮也有工具提示

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as wijmo from '@grapecity/wijmo'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { let tt = new wijmo.Tooltip(); // tt.setTooltip('#span1', 'This is the <b>first</b> span.'); tt.setTooltip('#span2', '#span2Tooltip'); tt.setTooltip('#btnAddNew', 'Click to add 1,000 items using the <b>addNew</b> method.'); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Tooltips</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <p> This paragraph has a <b id="span1">span with a tooltip</b>. </p> <p> This paragraph has a <b id="span2">span with a tooltip</b> whose content is taken from another element. </p> <p> The button below also have tooltip: </p> <button id="btnAddNew" class="btn btn-default"> addNew </button> <div id="span2Tooltip" style="display:none"> <div class="panel panel-info"> <div class="panel-heading"> Title </div> <div class="panel-body"> This is the second span. </div> </div> </div> </body> </html> .btn { margin: 4px; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, enableProdMode, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjCoreModule } from '@grapecity/wijmo.angular2.core'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { } // @NgModule({ imports: [WjCoreModule, BrowserModule], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } // enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Tooltips</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <p> This paragraph has a <b [wjTooltip]="'This is the <b>first</b> span.'">span with a tooltip</b>. </p> <p> This paragraph has a <b [wjTooltip]="'#spanTooltip'">span with a tooltip</b> whose content is taken from another element. </p> <p> The button below also have tooltip: </p> <button class="btn btn-default" [wjTooltip]="'Click to add 1,000 items using the <b>addNew</b> method.'"> addNew </button> <div id="spanTooltip" style="display:none"> <div class="panel panel-info"> <div class="panel-heading"> Title </div> <div class="panel-body"> This is the second span. </div> </div> </div> </div> .btn { margin: 4px; } <template> <div class="container-fluid"> <p> This paragraph has a <b id='span1'>span with a tooltip</b>. </p> <p> This paragraph has a <b id='span2'>span with a tooltip</b> whose content is taken from another element. </p> <p>The button below also have tooltip:</p> <button id='btnAddNew' class="btn btn-default" >addNew</button> <div id="spanTooltip" style="display:none"> <div class="panel panel-info"> <div class="panel-heading">Title</div> <div class="panel-body">This is the second span.</div> </div> </div> </div> </template> <script> import "bootstrap.css"; import "@grapecity/wijmo.styles/wijmo.css"; import Vue from "vue"; import * as wijmo from "@grapecity/wijmo"; let App = Vue.extend({ name: "app", mounted: function() { let tt = new wijmo.Tooltip(); tt.setTooltip("#span1", "This is the <b>first</b> span."); tt.setTooltip("#span2", "#spanTooltip"); tt.setTooltip( "#btnAddNew", "Click to add 1,000 items using the <b>addNew</b> method." ); } }); new Vue({ render: h => h(App) }).$mount("#app"); </script> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Tooltips</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); </script> </head> <body> <div id="app"> </div> </body> </html> import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './app.css'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import * as wijmo from '@grapecity/wijmo'; class App extends React.Component { constructor(props) { super(props); } ; componentDidMount() { let tt = new wijmo.Tooltip(); tt.setTooltip("#span1", "This is the <b>first</b> span."); tt.setTooltip("#span2", "#spanTooltip"); tt.setTooltip("#btnAddNew", "Click to add 1,000 items using the <b>addNew</b> method."); } render() { return <div className="container-fluid"> <p> This paragraph has a <b id='span1'>span with a tooltip</b>. </p> <p> This paragraph has a <b id='span2'>span with a tooltip</b> whose content is taken from another element. </p> <p>The button below also have tooltip:</p> <button id='btnAddNew' className="btn btn-default">addNew</button> <div id="spanTooltip" style={{ display: "none" }}> <div className="panel panel-info"> <div className="panel-heading">Title</div> <div className="panel-body">This is the second span.</div> </div> </div> </div>; } } ReactDOM.render(<App />, document.getElementById('app')); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>AutoComplete</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div id="app"></div> </body> </html> .btn { margin: 4px; }