Procházet zdrojové kódy

fix(jsx-runtime): handle keys (#7976)

Leonardo Piccioni de Almeida před 3 roky
rodič
revize
ff60b933ae

+ 6 - 1
packages/vue/jsx-runtime/index.js

@@ -1,6 +1,11 @@
 const { h, Fragment } = require('vue')
 
-function jsx(type, { children, ...props }) {
+function jsx(type, props, key) {
+  const { children } = props
+  delete props.children
+  if (arguments.length > 2) {
+    props.key = key
+  }
   return h(type, props, children)
 }
 

+ 6 - 1
packages/vue/jsx-runtime/index.mjs

@@ -1,6 +1,11 @@
 import { h, Fragment } from 'vue'
 
-function jsx(type, { children, ...props }) {
+function jsx(type, props, key) {
+  const { children } = props
+  delete props.children
+  if (arguments.length > 2) {
+    props.key = key
+  }
   return h(type, props, children)
 }