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

29 lines
567 B
Vue
Raw Normal View History

2017-12-22 18:43:28 +08:00
<script>
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]
},
}
</script>