diff --git a/README.md b/README.md index e4f9bb6..3f5dc38 100644 --- a/README.md +++ b/README.md @@ -111,10 +111,11 @@ In addition to `$mq` property this plugin provide a wrapper component to facilit Display on sm and lg ``` -**Props** -mq => required : String | Array +**Props**: +`mq`: (required) String | Array +`tag`: (required) String, default to `div` -*Important*: note that you can append a `+` modifier at the end of the string to specify that the conditional rendering happens for all greater breakpoints. +*Important*: note that you can append a `+` modifier at the end of the `mq` string to specify that the conditional rendering happens for all greater breakpoints. ## SSR Support v1.0+ now supports SSR. You can customize the `defaultBreakpoint` which let you set the breakpoint used by the server-side-rendering diff --git a/src/component.js b/src/component.js index 7a5556b..39e5de5 100644 --- a/src/component.js +++ b/src/component.js @@ -8,6 +8,11 @@ const component = { mq: { required: true, type: [String, Array], + }, + tag: { + required: true, + type: String, + default: 'div' } }, computed: { @@ -22,7 +27,7 @@ const component = { }, render(h, props) { const shouldRenderChildren = this.activeBreakpoints.includes(this.$mq) - return shouldRenderChildren ? h('div', this.$slots.default) : h() + return shouldRenderChildren ? h(this.tag, this.$slots.default) : h() }, }