Skip to content

The object syntax for events doesn't work in the render function(h()) #2237

Closed
@eliot-ye

Description

@eliot-ye

Version

3.0.0

Reproduction link

vue3 render-function v-on

Steps to reproduce

#2227

I have the same doubts as this issue. I don't know why the document said there was such a syntax, but the questions were closed.

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width">
 <title>JS Bin</title>
 <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
 <div id="app"></div>
 <script>
   Vue.createApp({
     setup(){
       let a = Vue.ref(0);
       let b = Vue.ref(0);
       return ()=>Vue.h(
         "div",
         [
           Vue.h("button", { onClick: () => a.value    }, `function: ${a.value}`),
           Vue.h("button", { onClick: {handler: () => b.value    } }, `object: ${b.value}`)
         ]
       )
     }
   }).mount("#app");
 </script>
</body>
</html>

What is expected?

The object syntax for events works in the render function.

What is actually happening?

It doesn't work.

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