Skip to content

CSS 中的 v-bind() 与 render一起使用 报错 #11264

Closed
@tthzwq

Description

@tthzwq

Vue version

3.3.4

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-vgk1dw?file=src%2FApp.vue&terminal=dev

Steps to reproduce

Playground中无法复现,复制以下代码到App.vue

<script setup>
import { createVNode, render } from 'vue';

const theme = { color: 'pink' };

const vnode = createVNode('div', {}, ['World']);

render(vnode, document.createElement('div'));
</script>

<template>
  <h1 class="main">Hello</h1>
</template>

<style scoped>
.main {
  background-color: v-bind('theme.color');
}
</style>

控制台报错
image

What is expected?

期望v-bind()render 一起使用能正常工作

What is actually happening?

删除.main的样式,就能正常工作了

System Info

System:
    OS: macOS 14.5
    CPU: (12) arm64 Apple M2 Pro
    Memory: 44.34 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.local/state/fnm_multishells/7092_1719794257039/bin/node
    npm: 10.2.4 - ~/.local/state/fnm_multishells/7092_1719794257039/bin/npm
    pnpm: 8.15.4 - ~/.local/state/fnm_multishells/7092_1719794257039/bin/pnpm
    bun: 1.1.17 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 126.0.6478.127

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions