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

28 lines
668 B
Vue
Raw Normal View History

2020-06-21 14:45:30 +00:00
import { Text } from 'vue';
2019-01-12 03:33:27 +00:00
import PropTypes from '../_util/vue-types';
import { getSlot } from '../_util/props-util';
2017-12-22 10:43:28 +00:00
export default {
2020-06-10 10:20:57 +00:00
name: 'LazyRenderBox',
2017-12-22 10:43:28 +00:00
props: {
visible: PropTypes.bool,
hiddenClassName: PropTypes.string,
},
2019-01-12 03:33:27 +00:00
render() {
2020-06-10 10:20:57 +00:00
const { hiddenClassName } = this.$props;
const child = getSlot(this);
2020-06-21 14:45:30 +00:00
if (
hiddenClassName ||
(child && child.length > 1) ||
(child && child[0] && child[0].type === Text)
) {
2020-06-10 10:20:57 +00:00
// const cls = '';
// if (!visible && hiddenClassName) {
// // cls += ` ${hiddenClassName}`
// }
return <div>{child}</div>;
2017-12-22 10:43:28 +00:00
}
2020-06-10 10:20:57 +00:00
return child && child[0];
2017-12-22 10:43:28 +00:00
},
2019-01-12 03:33:27 +00:00
};