Last active
August 11, 2017 11:35
-
-
Save anishdcruz/ace1185f76302f9261bb8f9f93a6a593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
{{sharedState.gallery}} | |
</template> | |
<script> | |
import Gallery from '../../js/helpers/gallery.js' | |
export default { | |
data() { | |
return { | |
sharedState: Gallery.state // is important | |
} | |
}, | |
mounted() { | |
// ajax | |
Gallery.setGallery([1,2,3,4]) | |
} | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// helper file | |
import Vue from 'vue' | |
export default { | |
state: { | |
gallery: [] | |
}, | |
setGallery(images) { | |
Vue.set(this.state, 'gallery', images) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment