1👍
✅
You need to actually call the IIFE:
window.Feed = (function() {
const stories = [{
id: 1,
title: 'Levani',
text: 'lorem ipsum',
votes: 0,
postedAt: '3min ago',
storyImage: 'https://loremflickr.com/320/240?random=1'
}, ]
return {
stories: stories
};
}()); // You need to actually CALL the IIFE so add "()"
new Vue({
el: '#app',
data: {
stories: Feed.stories
},
methods: {}
});
<div id="app">
<img v-bind:src="stories[0].storyImage" />
</div>
<script src="https://unpkg.com/vue"></script>
Source:stackexchange.com