You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
769 B
42 lines
769 B
|
|
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>
|
|
},
|
|
}
|
|
|