Skip to content

Commit

Permalink
Merge pull request #17 from DCzajkowski/open-at-prop
Browse files Browse the repository at this point in the history
Open at prop
  • Loading branch information
DCzajkowski authored May 5, 2019
2 parents 6822ac8 + 5002708 commit 42e5d3a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ import styles from 'vue-pure-lightbox/dist/VuePureLightbox.css'

### Available props:

| Prop | Type | Value |
| -------------- | ----------------- | ----------------------------------------------- |
| thumbnail | string | Path to a file being your thumbnail |
| images | string[] or array | Array of paths to files visible in the lightbox |
| alternate-text | string | **(Optional)** alt="" text for your image |
| value | boolean | **(Optional)** reactive visibility prop |
| Prop | Type | Value |
| -------------- | ----------------- | --------------------------------------------------------------- |
| thumbnail | string | Path to a file being your thumbnail |
| images | string[] or array | Array of paths to files visible in the lightbox |
| alternate-text | string | **(Optional)** alt="" text for your image |
| value | boolean | **(Optional)** reactive visibility prop |
| open-at-index | integer | **(Optional)** index of an image to show when opening the modal |

### Available slots:
| Slot | Description | Default |
Expand Down
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class="lb-demo"
:thumbnail="thumbnail"
:images="images"
:openAtIndex="1"
>
<LightboxDefaultLoader slot="loader" />
<div slot="content" slot-scope="{ url }">
Expand Down
10 changes: 7 additions & 3 deletions src/Components/Lightbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
images: {
type: Array,
},
openAtIndex: {
type: Number,
default: 0,
},
alternateText: {
type: String,
default: '',
Expand All @@ -72,7 +76,7 @@
data() {
return {
visible: this.value,
index: 0,
index: this.openAtIndex,
displayImage: true,
}
},
Expand All @@ -95,11 +99,11 @@
methods: {
show() {
this.visible = true
this.index = 0
this.index = this.openAtIndex
},
hide() {
this.visible = false
this.index = 0
this.index = this.openAtIndex
},
previous() {
if (this.hasPrevious) {
Expand Down

0 comments on commit 42e5d3a

Please sign in to comment.