I use the following code to detect a button click and get an image from unsplash that has random mode.
The problem is that it works once to get random. But the second time this does not change.
He does not request it again, he simply does not change it, because the same URL I think.
var vue = new Vue({
el: '#app',
data: {
styleObject: {
background: 'url(https://unsplash.it/1920/1080)'
}
},
methods: {
getImage: function() {
vue.styleObject.background = 'url(https://unsplash.it/1920/1080?random)'
}
}
})
I tried to erase a variable
getImage: function() {
vue.styleObject.background = '';
vue.styleObject.background = 'url(https://unsplash.it/1920/1080?random)'
}
But still no success, any ideas? thank you
source
share