Subscribe on changes!

在script-setup中发起异步请求,v-bind动态绑定样式失效

avatar
Dec 17th 2021

Version

3.2.0

Reproduction link

about:blank

Steps to reproduce

PseudoCode
<template>
  <div class="wrap"> {{ pageData }} </div>
</template>
<script setup>
    let color = 'red';
    const pageData = await reqFn( );
</script>
<style lang="scss" scoped>
.wrap {
    width: 100vw;
    height: 100vh;
    background: v-bind('color');
}
</style>

What is expected?

样式生效

What is actually happening?

1、组件外部已包裹 suspense 层 2、页面调用异步请求,形成”顶层await“后样式失效了,红色背景消失

avatar
Dec 17th 2021

You can create a reproduction via https://sfc.vuejs.org/ 看看能不能用这个复现: https://sfc.vuejs.org/

avatar
Dec 17th 2021

Hello, make sure to always provide a reproduction that follows the instructions at https://new-issue.vuejs.org/?repo=vuejs/vue-next#why-repro.

Open a new issue with a reproduction that follows those instructions if you manage to create a boiled down reproduction.