naive-ui/demo/utils/DocumentationWrapper.js
2021-01-13 12:01:02 +08:00

18 lines
403 B
JavaScript

import { i18n } from './composables'
export default {
setup () {
return {
...i18n()
}
},
render () {
const { locale } = this
const defaultSlot = (this.$slots.default && this.$slots.default()) || []
const index = defaultSlot.findIndex((VNode) => VNode.type.name === locale)
if (~index) {
return defaultSlot[index]
} else return defaultSlot[0] || null
}
}