File tree Expand file tree Collapse file tree 3 files changed +31
-33
lines changed Expand file tree Collapse file tree 3 files changed +31
-33
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,6 @@ const componentsModule: Module<Options> = function () {
159159 const templates = [
160160 'components/index.js' ,
161161 'components/plugin.js' ,
162- 'components/utils.js' ,
163162 'components/readme_md' ,
164163 'vetur/tags.json'
165164 ]
Original file line number Diff line number Diff line change 1- import { wrapFunctional } from './utils'
2-
31< %= options . getComponents ( ) . map ( c => {
42 const magicComments = [
53 `webpackChunkName: "${ c . chunkName } "` ,
@@ -15,3 +13,34 @@ import { wrapFunctional } from './utils'
1513 return `export { ${ exp } } from '../${ relativeToBuild ( c . filePath ) } '`
1614 }
1715} ) . join ( '\n' ) % >
16+
17+ // nuxt/nuxt.js#8607
18+ function wrapFunctional ( options ) {
19+ if ( ! options || ! options . functional ) {
20+ return options
21+ }
22+
23+ const propKeys = Array . isArray ( options . props ) ? options . props : Object . keys ( options . props || { } )
24+
25+ return {
26+ render ( h ) {
27+ const attrs = { }
28+ const props = { }
29+
30+ for ( const key in this . $attrs ) {
31+ if ( propKeys . includes ( key ) ) {
32+ props [ key ] = this . $attrs [ key ]
33+ } else {
34+ attrs [ key ] = this . $attrs [ key ]
35+ }
36+ }
37+
38+ return h ( options , {
39+ on : this . $listeners ,
40+ attrs,
41+ props,
42+ scopedSlots : this . $scopedSlots ,
43+ } , this . $slots . default )
44+ }
45+ }
46+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments