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.
20 lines
606 B
TypeScript
20 lines
606 B
TypeScript
3 years ago
|
import { InfoDialog } from 'vj/components/dialog';
|
||
|
import i18n from 'vj/utils/i18n';
|
||
|
import tpl from 'vj/utils/tpl';
|
||
|
|
||
|
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)),
|
||
|
}).open();
|
||
|
};
|
||
|
$(element).append(a);
|
||
|
}
|