Hi there,
I have a page in a .vue component, which uses calendar (among others).
The relevant part of script section is:
import Framework7 from 'framework7'
import Calendar from 'framework7/components/calendar/calendar.js'
import Input from 'framework7/components/input/input.js'
import Popover from 'framework7/components/popover/popover.js'
import SmartSelect from 'framework7/components/smart-select/smart-select.js'
Framework7.use([Calendar, Input, Popover, SmartSelect]);
export default {
data() {
return {
....
}
},
methods: {
onPageBeforeInit(e) {
const self = this;
const app = self.$f7;
let calendar = app.calendar.create({
inputEl: '#validityDateSelector',
closeOnSelect: true,
dateFormat: 'yyyy.mm.dd.',
routableModals: false,
});
}
}
}
All works fine if the component is routed the simple way like this:
...
import PageWithCalendar from './pages/page-with-calendar.vue'
...
{
name: 'page-with-calendar',
path: '/page-with-calendar/',
component: PageWithCalendar,
},
But if I change the route to async and omit the page import, then app.calendar is undefined during the PageBeforeInit callback and the page component fails to load:
...
{
name: 'page-with-calendar',
path: '/page-with-calendar/',
async(routeTo, routeFrom, resolve, reject) {
const vueComponent = () => import('./pages/page-with-calendar.vue');
vueComponent().then((vc) => {
resolve({ component: vc.default });
});
},
...
Seems to me as a module dependency issue (which can be resolved compile-time, but fails runtime).
I’m using the webpack4 template, with f7-vue 3.5.1.
Thanks in advance,
Bálint