deepq-utils
v1.1.5
Published
Downloads
2
Readme
dq-utils
API
breadthTraversal
广度遍历
getHighlight
解析dom字符串并设置高亮
const { getHighlight } = DqUtils
const html = `<section class='origin'>
<span class='origin'>文字哦这是文</span>
<span class='origin'>一段文</span>
<span class='origin'>字测试文字哦敏</span>
</section>
<div>
<p>段落1</p>
<span class='origin'>感文字哦</span>
</div>`;
const res = getHighlight(html, [
{
highlightClass: 'active-red',
mathRule: '文字哦'
},
{
highlightClass: 'active-green',
mathRule: '敏'
},
]);
const resDom = document.getElementById('res')
app.innerHTML = html
resDom.innerHTML = res
initLogger
高亮显示
import { initLogger } from 'dq-utils';
initLogger();
console.bgBlackBright.greenBright.log(
'current login user is: ',
UserModule.name
);