We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do NOT ignore this template or your issue will have a very high chance to be closed without comment.
When the component is mounted, getComputedStyle will get default style instead of the style in CSS
getComputedStyle
vite
vue
yarn.lock
package-lock.json
@vue/compiler-sfc
vite build
--debug
css:
.content { line-height: 24px; }
js:
const contentRef = ref(null); onMounted(() => { let { lineHeight, height } = getComputedStyle(contentRef.value); console.log(height, lineHeight); // 63px normal showBtn.value = parseFloat(height) / parseFloat(lineHeight) > 2; });
The text was updated successfully, but these errors were encountered:
fix: update style should be after css loaded.Use sync (js import) ins…
6621541
…tead of async(link load) fix vitejs#175
fix: make style injection sync on component mount (#176)
f6a21b2
fix #175
Successfully merging a pull request may close this issue.
Describe the bug
When the component is mounted,
getComputedStyle
will get default style instead of the style in CSSSystem Info
vite
version: 0.15.0vue
version (fromyarn.lock
orpackage-lock.json
)@vue/compiler-sfc
versionLogs (Optional if provided reproduction)
vite
orvite build
with the--debug
flag.css:
js:
The text was updated successfully, but these errors were encountered: