naive-ui/demo/utils/DocumentationWrapper.vue
2020-10-08 04:14:14 +08:00

20 lines
429 B
Vue

<script>
import { i18n } from '../util-compositions'
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
}
}
</script>