vuejs / babel-plugin-jsx

JSX for Vue 3
https://vue-jsx-explorer.netlify.app
MIT License
1.7k stars 143 forks source link

[BUG] {} 渲染异常 #682

Closed wanchun closed 1 month ago

wanchun commented 8 months ago

🐛 Bug description

组件:

import { defineComponent } from 'vue'

export default defineComponent({
    props: {
        title: String
    },
    setup(props){
        return ()=>{
            return <div>{props.title}</div>
        }
    }
})

当传入的title从对象变成字符串,就会报错

const title = ref({a: 1})

setTimeout(() => {
  title.value = 1;
}, 1000);

📝 Steps to reproduce

Reproduction Link (required):

https://github.com/wanchun/jsx-bug

🏞 Desired result

企业微信截图_2f97ab77-0ddd-499c-9812-e462b316d909

🚑 Other information

sxzz commented 1 month ago

在JSX中,不能直接渲染一个对象,不会转换为 JSON。