mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-04 13:08:48 +08:00
42 lines
769 B
JavaScript
42 lines
769 B
JavaScript
|
|
import omit from 'omit.js'
|
|
export default {
|
|
name: 'DOMWrap',
|
|
props: {
|
|
visible: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
tag: {
|
|
type: String,
|
|
default: 'div',
|
|
},
|
|
hiddenClassName: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
},
|
|
computed: {
|
|
class () {
|
|
const { visible, hiddenClassName } = this.$props
|
|
return {
|
|
[hiddenClassName]: !visible,
|
|
}
|
|
},
|
|
},
|
|
render () {
|
|
const otherProps = omit(this.$props, [
|
|
'tag',
|
|
'hiddenClassName',
|
|
'visible',
|
|
])
|
|
const Tag = this.$props.tag
|
|
const tagProps = {
|
|
attr: { ...otherProps, ...this.$attrs },
|
|
on: this.$listeners,
|
|
}
|
|
return <Tag {...tagProps} class={this.class}>{this.$slots.default}</Tag>
|
|
},
|
|
}
|
|
|