ant-design-vue/components/trigger/LazyRenderBox.jsx

28 lines
549 B
React
Raw Normal View History

2018-03-19 10:16:27 +08:00
2017-12-26 19:04:28 +08:00
import PropTypes from '../_util/vue-types'
2017-12-22 18:43:28 +08:00
export default {
props: {
visible: PropTypes.bool,
hiddenClassName: PropTypes.string,
},
render () {
2017-12-25 18:08:36 +08:00
const { hiddenClassName, visible } = this.$props
2017-12-22 18:43:28 +08:00
2017-12-27 16:13:26 +08:00
if (hiddenClassName || !this.$slots.default || this.$slots.default.length > 1) {
2017-12-22 18:43:28 +08:00
let cls = ''
if (!visible && hiddenClassName) {
cls += ` ${hiddenClassName}`
}
return (
<div class={cls}>
{this.$slots.default}
</div>
)
}
return this.$slots.default[0]
},
}