Framework7 5.7.2
app.views.current…
app.views.create('#view-home', {
url: '/home/list-hot/',
stackPages: true,
unloadTabContent: false,
iosDynamicNavbar: false,
removeElements:true
});
maybe the reason is removeElements ?
i remove this parameters and try again
Not solution , when error hanppen, this tab page can swiper, but all of links (or app.views.current.navigate) is fail
i found the reason, i use Tabbed Views
this is the layout:
<div class="views tabs color-theme-orange">
<div class="toolbar main-toolbar tabbar tabbar-labels no-shadow toolbar-bottom no-hairline" style="-webkit-backdrop-filter:unset;background-color: transparent">
<div class="toolbar-inner">
<a href="#view-home" class="tab-link tab-link-active">
<img id="tabbar-image-home" class="tabbar-image" src="">
<span class="tabbar-label">Home</span>
</a>
<a href="#view-event" class="tab-link">
<img id="tabbar-image-event" class="tabbar-image" src="">
<div id="DynamicBadge" style="position: absolute;margin-top: -2px;margin-left: 10px;width:12px;height:12px;border: 2px solid white;border-radius: 50%;" class="bg-color-red"></div>
<span class="tabbar-label">Event</span>
</a>
<a href="#" class="tab-link" style="visibility: hidden"></a>
<a href="#view-message" class="tab-link">
<img id="tabbar-image-message" class="tabbar-image" src="">
<span class="tabbar-label">Message</span>
</a>
<a href="#view-my" class="tab-link">
<img id="tabbar-image-my" class="tabbar-image" src="">
<span class="tabbar-label">My</span>
</a>
</div>
<a href="#" class="link live-button"></a>
</div>
<div id="view-home" class="view tab view-main tab-active safe-areas">
</div>
<div id="view-event" class="view tab safe-areas">
</div>
<div id="view-message" class="view tab safe-areas">
</div>
<div id="view-my" class="view tab safe-areas">
</div>
</div>
and init #view-home
use:
var mainView = app.views.create('#view-home', {
url: '/home/list-hot/',
stackPages: true,
unloadTabContent: false,
iosDynamicNavbar: false
});
when open popup (use view-init
) not in view-home
tab , the mainView.router.currentRoute
is change to other view’s route , so back to view-home
thow error.
i found the document of view-main
Where is init others view?
other view’s init code is:
eventView = app.views.create('#view-event', {
url: has_live_dynamic ? 'dynamic/dynamic-1/':'dynamic/dynamic-2/',
stackPages: true,
unloadTabContent: false,
iosDynamicNavbar: false,
});
messageView = app.views.create('#view-message', {
url: 'rank/rank-list-1/',
stackPages: false,
unloadTabContent: false,
iosDynamicNavbar: false,
});
myView = app.views.create('#view-my', {
url: '/my/index/',
stackPages: true,
unloadTabContent: false,
iosDynamicNavbar: false,
});
i create a global var mainViewRoute
to store mainView.router.currentRoute
,
when tab:show
check the currentRoute , it work, no error found
$$("#view-home").on('tab:show', function () {
if(mainView.router.currentRoute.url.substr(0,6) != "/home/"){
mainView.router.currentRoute = mainViewRoute;
}
});
@bobo please make a minimal example using template from this topic How to ask a good question on forum so we can see the actual issue
this is the example:
step is:
1, click tab my
2, click go to live room...
3, click open gift sheet
4, click open pay
5, close pay page and back to tab my
6, click tab home
and click link will throw error
this is my popup , sheet setting:
popup: {
backdrop: true,
closeByBackdropClick: true,
},
sheet: {
backdrop: true,
closeByBackdropClick:true,
},
Ok, as you are using routable modals, I see something got messed in router. Just open routable modals in main view, e.g. add data-view=".view-main"
to links that open routable modals (sheet and popup)
<a href="/gift-sheet/" class="link" data-view=".view-main">open gift sheet</a>
<a href="/pay/" class="link" data-view=".view-main">open pay</a>
it work, but i have too many link to change , and some sheet or popup use script to open,
i don’t know why the mainView.router.currentRoute is change when sheet closed