Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
fix(image-list): Fix type comparison & use image slot in ImageListItem
Browse files Browse the repository at this point in the history
  • Loading branch information
matsp committed Mar 27, 2018
1 parent 1d10870 commit f0a7a1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions components/image-list/ImageList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export default {
computed: {
classes () {
let standard = {}
if (this.standardColumn > 0 && typeof this.masonryColumn === 'null') {
if (this.standardColumn > 0 && typeof this.masonryColumn === 'undefined') {
standard['image-list-standard-' + this.standardColumn] = true
}
let masonry = {}
if (this.masonryColumn > 0 && typeof this.standardColumn === 'null') {
if (this.masonryColumn > 0 && typeof this.standardColumn === 'undefined') {
masonry['image-list-masonry-' + this.masonryColumn] = true
masonry['mdc-image-list--masonry'] = true
}
Expand Down
20 changes: 10 additions & 10 deletions components/image-list/ImageListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
<div
v-if="adjustAspectRatio"
class="mdc-image-list__image-aspect-container">
<img
class="mdc-image-list__image"
:src="src">
<slot name="image"/>
</div>
<img
<slot
v-else
class="mdc-image-list__image"
:src="src">
name="image"/>
<div
v-if="$slots['default']"
class="mdc-image-list__supporting">
Expand All @@ -24,14 +21,17 @@
<script>
export default {
props: {
src: {
type: String,
required: true
},
adjustAspectRatio: {
type: Boolean,
default: true
}
},
mounted () {
if (this.$slots.image) {
this.$slots.image.map(n => {
n.elm.classList.add('mdc-image-list__image')
})
}
}
}
</script>

0 comments on commit f0a7a1b

Please sign in to comment.