Skip to content

Commit 6927ca7

Browse files
committed
Merge branch 'develop'
* develop: chore(release): 1.1.0 feat(debug): Add proper render condition and console warnings
2 parents eb2497e + 586d86d commit 6927ca7

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4+
5+
<a name="1.1.0"></a>
6+
# [1.1.0](https://github.com/apertureless/vue-breakpoints/compare/v1.0.0...v1.1.0) (2018-04-05)
7+
8+
9+
### Features
10+
11+
* **debug:** Add proper render condition and console warnings ([3afe976](https://github.com/apertureless/vue-breakpoints/commit/3afe976))
12+
* **render:** Remove surrounding divs in render function ([9395fab](https://github.com/apertureless/vue-breakpoints/commit/9395fab))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-breakpoints",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Vue.js utility component to show and hide components based on breakpoints",
55
"author": "Jakub Juszczak <[email protected]>",
66
"license": "MIT",

src/components/hideAt.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
}
4545
4646
if (shouldRender) {
47-
return this.$slots.default[0]
47+
return this.$slots.default ? this.$slots.default[0] : null
4848
}
4949
return null
5050
}

src/components/showAt.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
}
4545
4646
if (shouldRender) {
47-
return this.$slots.default[0]
47+
return this.$slots.default ? this.$slots.default[0] : null
4848
}
4949
return null
5050
}

src/components/withBreakpoint.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
mounted () {
2626
window.addEventListener('resize', this.handleResize)
2727
this.handleResize()
28+
if (this.$slots.default && this.$slots.default.length > 1) {
29+
console.warn('[✋ vue-breakpoints] You may only wrap one element in a <showAt> or <hideAt/> component.')
30+
} else if (!this.$slots.default || this.$slots.default.length < 1) {
31+
console.warn('[✋ vue-breakpoints] You must have one child inside a <showAt> or <hideAt/> component.')
32+
}
2833
},
2934
3035
beforeDestroy () {

0 commit comments

Comments
 (0)