Skip to content
New issue

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

SFC Playground: styles are loaded after mounting of the app component #9847

Closed
silentmantra opened this issue Dec 16, 2023 · 3 comments
Closed

Comments

@silentmantra
Copy link

silentmantra commented Dec 16, 2023

Vue version

3.3.12

Link to minimal reproduction

Vue SFC Playground

Steps to reproduce

Load the SFC Playground link.

<script setup>

import { onMounted, ref } from 'vue'

const div = ref();
const log = ref();
onMounted(()=>{
  log.value.textContent = div.value.offsetWidth;
});
const showWidth = () => log.value.textContent = div.value.offsetWidth;
</script>

<template>
  <div ref="div"></div>
  <button @click="showWidth">Show width</button>
  <div ref="log"></div>
</template>

<style scoped>
div{
  width: 50vw;
}
</style>

What is expected?

The styles are applied before onMounted() so the styled DIV would have a proper width.

What is actually happening?

In onMounted() the mounted component is unstyled, leading to a wrong offsetWidth reading.

System Info

No response

Any additional comments?

No response

@Alfred-Skyblue
Copy link
Member

This is an issue with the repl, and I have already fixed it in vuejs/repl#191

@silentmantra
Copy link
Author

This is an issue with the repl, and I have already fixed it in vuejs/repl#191

how we can merge it?

@LinusBorg
Copy link
Member

Closing this as it's being fixed in the repl.

The PR will be merged when we get to reviewing it. It's not a priority topic at this moment, as we are putting our attention on Vue 3.4 and 2.7.16 till EOY.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants