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';
|
2020-06-14 13:41:29 +00:00
|
|
|
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: {
|
2020-10-10 10:16:28 +00:00
|
|
|
visible: PropTypes.looseBool,
|
2017-12-22 10:43:28 +00:00
|
|
|
hiddenClassName: PropTypes.string,
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
2020-06-10 10:20:57 +00:00
|
|
|
const { hiddenClassName } = this.$props;
|
2020-06-14 13:41:29 +00:00
|
|
|
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}`
|
|
|
|
// }
|
2020-06-14 13:41:29 +00:00
|
|
|
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
|
|
|
};
|