You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/packages/ui-default/components/hint.ts

20 lines
608 B
TypeScript

import $ from 'jquery';
import { InfoDialog } from 'vj/components/dialog';
import { i18n, tpl } from 'vj/utils';
export default function createHint(message: string, element?: any) {
if (i18n(message) === message || !element) return;
const a = document.createElement('a');
a.setAttribute('href', 'javascript:;');
const span = document.createElement('span');
span.setAttribute('class', 'icon icon-help');
a.appendChild(span);
a.onclick = () => {
new InfoDialog({
cancelByClickingBack: false,
$body: tpl.typoMsg(i18n(message), true),
}).open();
};
$(element).append(a);
}