mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
31 lines
662 B
JavaScript
31 lines
662 B
JavaScript
|
// nuxt/nuxt.js#8607
|
||
|
export function wrapFunctional(options) {
|
||
|
if (!options || !options.functional) {
|
||
|
return options
|
||
|
}
|
||
|
|
||
|
const propKeys = Array.isArray(options.props) ? options.props : Object.keys(options.props || {})
|
||
|
|
||
|
return {
|
||
|
render(h) {
|
||
|
const attrs = {}
|
||
|
const props = {}
|
||
|
|
||
|
for (const key in this.$attrs) {
|
||
|
if (propKeys.includes(key)) {
|
||
|
props[key] = this.$attrs[key]
|
||
|
} else {
|
||
|
attrs[key] = this.$attrs[key]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return h(options, {
|
||
|
on: this.$listeners,
|
||
|
attrs,
|
||
|
props,
|
||
|
scopedSlots: this.$scopedSlots,
|
||
|
}, this.$slots.default)
|
||
|
}
|
||
|
}
|
||
|
}
|