mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 08:36:19 +08:00
fix: improve the dialog and drawer scrollbar experience, fix internal click failure problems and warnings (#4391)
* fix: improve the dialog and drawer scrollbar experience, fix internal click failure problems and warnings * chore: remove test code
This commit is contained in:
@@ -50,3 +50,22 @@ export function getElementVisibleRect(
|
||||
width: Math.max(0, right - left),
|
||||
};
|
||||
}
|
||||
|
||||
export function getScrollbarWidth() {
|
||||
const scrollDiv = document.createElement('div');
|
||||
|
||||
scrollDiv.style.visibility = 'hidden';
|
||||
scrollDiv.style.overflow = 'scroll';
|
||||
scrollDiv.style.position = 'absolute';
|
||||
scrollDiv.style.top = '-9999px';
|
||||
|
||||
document.body.append(scrollDiv);
|
||||
|
||||
const innerDiv = document.createElement('div');
|
||||
scrollDiv.append(innerDiv);
|
||||
|
||||
const scrollbarWidth = scrollDiv.offsetWidth - innerDiv.offsetWidth;
|
||||
|
||||
scrollDiv.remove();
|
||||
return scrollbarWidth;
|
||||
}
|
||||
|
Reference in New Issue
Block a user