mashirozx 2021-08-08 22:23:36 +08:00
parent 84e3fc1ca4
commit bd43413476
2 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { onUnmounted, onDeactivated } from 'vue' import { onUnmounted, onDeactivated } from 'vue'
import getScrollbarWidth from '@/utils/getScrollbarWidth' import getScrollbarWidth from '@/utils/getScrollbarWidth'
export default function () { export default function () {
const removeScrollLock = () => { const removeScrollLock = () => {
const body = document.querySelector('body') const body = document.querySelector('body')

View File

@ -1,4 +1,4 @@
const getScrollbarWidth = () => { export default function getScrollbarWidth() {
const div1 = document.createElement('div') const div1 = document.createElement('div')
const div2 = document.createElement('div') const div2 = document.createElement('div')
div1.style.width = div2.style.width = div1.style.height = div2.style.height = '100px' div1.style.width = div2.style.width = div1.style.height = div2.style.height = '100px'
@ -11,5 +11,3 @@ const getScrollbarWidth = () => {
document.body.removeChild(div2) document.body.removeChild(div2)
return scrollbarWidth return scrollbarWidth
} }
export default getScrollbarWidth