Currently, I'm working on developing a Chrome extension using Vue and Browserify. Within my component file, I'm attempting to invoke a method called animateBackground
from the mounted
hook. However, when checking the console, an error message is being displayed. How can I properly access the data and methods within the component?
export default {
name: "app",
data() {
return {
'message': "thgdfseaw"
}
},
mounted() {
chrome.storage.local.get("bingImage", function(output) {
if (output != undefined || output != null) {
console.log(this.message);
this.animateBackground(output.bingImage.base64);
}
});
},
methods: {
animateBackground(base64) {
$("#app").animate({ opacity: 0 }, "slow", function() {
$(this)
.css({ "background-image": "url(" + base64 + ")" })
.animate({ opacity: 1 });
});
}
},
components: {
AppSection
}
};