I’m new to both Framework7 and Vue - and I’ve started my first application around the Framwork7/Vue default setup application.
I’m trying to get my head around the tabbed menu which is located in the app.vue
All the views within this menu, are run (ie, mounted) on the app launching - my issue is that the majority of these views require the user to be logged in to load personalised data - so originally, I was including an ajax function on the mounted function - but obviously, this is getting loaded on app launch when the user isn’t logged in and no data is returned. And it’s not rerun when the user clicks the tabs.
Within the Framework7/Vue environment, what’s the best way to fun a function when a view is shown/opened.
Currently, my solution has been to remove the mounted functions out of all the tabbed views, and include them in the Vue.mixin({
on app setup. This means I can access them when the tab is clicked.
<f7-view id="view-profile" name="profile" tab url="/profile/" @tab:show="this.getProfile"></f7-view>
This is works - but obviously, I would potentially ideally like to keep everything within the profile.vue, so that if I were to link to a page from anywhere else, that it simply just runs. Is there an event/function that I can include within the profile.vue export default {
which will fire everytime the page is accessed through the view?
It could be that I’m not understanding something about this combined environment of Framework7/Vue as I’m new to both.