(type, props, ...children)
| 1 | import { h } from 'vue'; |
| 2 | |
| 3 | export function createElement(type, props, ...children) { |
| 4 | const adaptedProps = Object.entries(props || {}).reduce( |
| 5 | (acc, [key, value]) => { |
| 6 | // Vue 3 accepts lower-case event names so we need to transform props like |
| 7 | // `onMouseMove` to `onMousemove`. |
| 8 | const property = |
| 9 | key[0] === 'o' && key[1] === 'n' |
| 10 | ? key.slice(0, 3) + key.slice(3).toLowerCase() |
| 11 | : key; |
| 12 | |
| 13 | acc[property] = value; |
| 14 | return acc; |
| 15 | }, |
| 16 | {} |
| 17 | ); |
| 18 | |
| 19 | return h(type, adaptedProps, ...children); |
| 20 | } |
no outgoing calls