ant-design-vue/components/vc-menu/DOMWrap.jsx

42 lines
769 B
React
Raw Normal View History

2018-03-19 02:16:27 +00:00
2017-12-08 06:31:53 +00:00
import omit from 'omit.js'
export default {
name: 'DOMWrap',
props: {
visible: {
type: Boolean,
default: false,
},
tag: {
type: String,
default: 'div',
},
2018-01-02 11:05:02 +00:00
hiddenClassName: {
type: String,
default: '',
},
2017-12-08 06:31:53 +00:00
},
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 },
2018-01-09 06:21:15 +00:00
on: this.$listeners,
2017-12-08 06:31:53 +00:00
}
2018-01-02 11:05:02 +00:00
return <Tag {...tagProps} class={this.class}>{this.$slots.default}</Tag>
2017-12-08 06:31:53 +00:00
},
}
2018-03-19 02:16:27 +00:00