Skip to content

Commit

Permalink
chore: update eslintrc.js and config.ts (#2307)
Browse files Browse the repository at this point in the history
* Update .eslintrc.js

* Update config.ts

优化了查询逻辑

* chore: fix insert version

* style: format

* style: format

---------

Co-authored-by: liuyib <1656081615@qq.com>
  • Loading branch information
xiezheng-XD and liuyib authored Dec 26, 2023
1 parent 6266eaa commit 532aa18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'consistent-return': 'off',
'import/no-useless-path-segments': 'off',
'no-unused-expressions': 'off',
'react-hooks/rules-of-hooks': 'error',
Expand Down
27 changes: 17 additions & 10 deletions config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,27 @@ export default {
scripts: [
'https://s4.cnzz.com/z_stat.php?id=1278992092&web_id=1278992092',
`
const insertVersion = function(){
const insertVersion = function() {
const logo = document.querySelector('.__dumi-default-navbar-logo');
if (!logo) return;
const dom = document.createElement('span');
dom.id = 'logo-version';
dom.innerHTML = '${packages.version}';
const logo = document.querySelector('.__dumi-default-navbar-logo');
if(logo){
logo.parentNode.insertBefore(dom, logo.nextSibling);
}else{
setTimeout(()=>{
insertVersion();
}, 1000)
logo.parentNode.insertBefore(dom, logo.nextSibling);
};
const observer = new MutationObserver((mutationsList, observer) => {
for (const mutation of mutationsList) {
if (mutation.type === 'childList') {
const logoVersion = document.querySelector('#logo-version');
if (logoVersion) {
observer.disconnect();
} else {
insertVersion();
}
}
}
}
insertVersion();
});
observer.observe(document.body, { childList: true, subtree: true });
`,
],
};

0 comments on commit 532aa18

Please sign in to comment.