0👍
beforeMount
is a lifecycle hook, not a method. It must be defined directly within options, not inside methods
:
export default {
name: "FooterComponent",
data() {
return {
privacy_modal: false,
privacy_title: '',
privacy_content: ''
};
},
beforeMount() {
this.privacy_title = localStorage.getItem("privacy_title"); // || "some default value"
},
methods: {
// custom methods
}
};
Also, don’t forget to update local storage, as demanded by your app logic.
Source:stackexchange.com