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
7 years ago
|
|
||
7 years ago
|
import omit from 'omit.js'
|
||
|
export default {
|
||
|
name: 'DOMWrap',
|
||
|
props: {
|
||
|
visible: {
|
||
|
type: Boolean,
|
||
|
default: false,
|
||
|
},
|
||
|
tag: {
|
||
|
type: String,
|
||
|
default: 'div',
|
||
|
},
|
||
7 years ago
|
hiddenClassName: {
|
||
|
type: String,
|
||
|
default: '',
|
||
|
},
|
||
7 years ago
|
},
|
||
|
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 },
|
||
7 years ago
|
on: this.$listeners,
|
||
7 years ago
|
}
|
||
7 years ago
|
return <Tag {...tagProps} class={this.class}>{this.$slots.default}</Tag>
|
||
7 years ago
|
},
|
||
|
}
|
||
7 years ago
|
|