My problem is about wechat pages jump ,when i want jump to one page ,it always flash another pages - wechat

pages order is shelf->photo->refer->photos->shelf.but when photos->shelf,the refer page always flash.
wx.navigateTo({
url: '../shelf?rstoreId=' + this.data.rstoreId,
})

Be sure that there are 'shelf.wxml','shelf.wxss' and 'shelf.js' in your 'shelf' folder.
Use '../shelf/shelf' instead of '../shelf'
wx.navigateTo({
url: '../shelf/shelf?rstoreId=' + this.data.rstoreId,
})

Related

After navigating to another page hybridWebView does not register any actions

I use project hybridWebView standart. Xamarin.Forms - HybridWebView Custom Renderer
If i use the html file that is in the Android project - Content / index.html - Everything works.
If I use html file which is hosted by mysite.com - The first time the hybridWebViewPage.axml page is loaded, I get the data in a variable var data. If I go to another page, and then go back to the hybridWebViewPage.axml page, I do not get data in the variable var data.
hybridWebView.RegisterAction(data => DisplayAlert("Alert", "Hello " + data, "OK"));
Why is this happening?
Because the hybridWebView.RegisterAction method is called in the construction method of the contentpage which will be called when you navigate to it first time. In addition, when you come back from another page, the construction method will not be called because the instance of it is still in the storge. There is the link about the navigation stack.link

Stop fancy box 3 opening when iframe URL fails to load

I'd like to be able to redirect to a given URL if it fails to load with Fancybox 3. The users supply the URL's so it could be a youtube video, image, or some other arbitrary link. In the case of something like a Google Doc, google prevents you from loading those inside iframes, so I'd like to catch that error and stop the fancy box viewer from loading at all and instead redirect to that URL directly in the browser. I can kind of get it working but I can't seem to stop the fancy box dialog from showing before the redirect happens:
$.fancybox.defaults.afterLoad = (instance, current) ->
if current.hasError
window.location = current.src
instance.close()
I've tried returning false.
This is the best I have come up with so far:
$.fancybox.defaults.defaultType = 'iframe'
$.fancybox.defaults.beforeLoad = (instance, current) ->
$.ajax
url: current.src
method: 'HEAD'
.catch ->
window.location = current.src
instance.close()
The default for a URL is ajax if it fails all the other tests (like image and video), so we need to switch this to iframe first. Then I do an ajax HEAD call to see if the result is successful, if not, we can just redirect to the src. instance.close() is the best way I could find to stop the fancybox from loading (it could already be loaded if this is a slideshow/gallery anyway). There is a brief flash before the page then redirects to the URL.
As #misorude mentions, there isn't a way to detect if the iframe failed to load for cross site requests. In the end I decided to do away with previewing off-site links completely and do a redirect like so:
$.fancybox.defaults.afterLoad = (instance, slide) ->
if !slide.redirecting && slide.contentType == 'html'
slide.redirecting = true
message = """<div class="fancybox-error"><p>Redirecting...</p></div>"""
instance.setContent slide, message
window.location = slide.src
This displays a nice redirecting message and then sends the user on to that link via the browser. contentType is only html when it's not image, video, map etc... from the other media type plugins. This means fancybox can still show youtube links without trouble even though these are iframe and html based.

How caching of pages use ionic 2?

Can I save the page status if I moved to new page?
I have a map and some objects on the map. I want if map is loaded, that all state saving if i moved new page and then I come back. That's it high-loaded process (+ loading image again). Use lealetjs
Thanks!
I solved my problem as follows:
I change app architecture - I add two tabs (list elements page and map with markers). And when I opened map page use tabs - page loaded and it's Ok!
Explanation of work ionic:
If you use navCtrl.pop() - current page will be deleted from memory. But If you can not use tabs - use navCtrl.push() new before page. And when user will want to return before page - navCtrl.pop() - delete current page, but before page will be cached.
That is, from the user's point of view - it's back is already on the previous page, and from the point of view of the programmer - a new same page is being created.
And if user wants to move to before->before page, use navCtrl.popTo(index of the desired page - you can use this.navCtrl.popTo(this.navCtrl.getByIndex([yourPageNumber]));

Prism Xamarin Navigation - strange behaviour

I have a MasterDetail page which in Xaml has defined a navigation menu as a master bit and just an empty Detail.
Once user logs in I navigate to the main page using the following path
await _navigationService.NavigateAsync(PageCodes.NavigateTo_MainMenuPage + "/" + PageCodes.NavigateTo_NavigationPage + "/" + PageCodes.NavigateTo_WelcomePage);
NavigateTo_MainMenuPage is my MasterDetail Page
NavigateTo_NavigationPage an empty Navigation page
NavigateTo_WelcomePage my home page (content page)
This works perfectly, iOS shows both Navigation (master) and Welcome page (content page)
One of the options in the navigation is to go to About page (so user triggers this via MasterDetail.Master XAML)
I expected that this code
await _navigationService.NavigateAsync(PageCodes.NavigateTo_WebPage, param);
will replace the Detail bit of the MasterDetail Page but instead of that it opens it as a model page (full screen) and app loses the Hamburger menu. I even tried to add false, after param but it didn't work
This code
await _navigationService.NavigateAsync(PageCodes.NavigateTo_NavigationPage + "/" + PageCodes.NavigateTo_WebPage, param, false);
opens the page as a child of the main page (iOS shows back to welcome page) which I don't want.
I even tried this code
await _navigationService.NavigateAsync(PageCodes.NavigateTo_MainMenuPage + "/" + PageCodes.NavigateTo_NavigationPage + "/" + PageCodes.NavigateTo_WebPage, param, false);
but it shows NavigateTo_WebPage without Master page and as I can see the hamburger menu is missing
Just to clarify all this code is happening in the view of MainMenuPage (MainMenuPageViewModel)
So My question is what I'm doing wrong and how to push with Prism new content to Detail bit of MasterDetail page
thanks in advance!!!
I've managed to fix the problem. My Navigation page didn't have a ViewModel. Frankly, I thought as it's a dummy page without any logic I don't need the ViewModel.
As soon as I added the page, everything was fine

FlowRouter without page reload

I am following this example https://kadira.io/academy/meteor-routing-guide/content/rendering-blaze-templates
When I click on my links the whole page is being reloaded. Is there any way to load only the template part that is needed and not the whole page?
Edit: Also I noted another problem. Everything that is outside {{> Template.dynamic}} is being rendered twice.
Here is my project sample. https://github.com/hayk94/UbMvp/tree/routing
EDIT: Putting the contents in the mainLayout template and starting the rendering from there fixed the double render problems. However the reload problems happen because of this code
Template.mainLayout.events({
"click *": function(event, template){
event.stopPropagation();
console.log('body all click log');
// console.log(c0nnIp);
var clickedOne = $(event.target).html().toString();
console.log('This click ' + clickedOne);
//getting the connID
var clientIp = null // headers.getClientIP(); // no need for this anymore
var clientConnId = Meteor.connection._lastSessionId;
console.log(clientIp);
console.log(clientConnId);
Meteor.call("updateDB", {clientIp,clientConnId,clickedOne}, function(error, result){
if(error){
console.log("error", error);
}
if(result){
}
});
}, // click *
});//events
Without this event attached to the template the routing works without any reloads, however as soon as I attach it the problem persists.
Do you have any ideas why this code causes such problems?
EDIT 2 following question Rev 3:
event.stopPropagation() on "click *" event probably prevents the router from intercepting the click on link.
Then your browser performs the default behaviour, i.e. navigates to that link, reloading the whole page.
EDIT following question Rev 2:
Not sure you can directly use your body as BlazeLayout target layout.
Notice in the first code sample of BlazeLayout Usage that they use an actual template as layout (<template name="layout1">), targeted in JS as BlazeLayout.render('layout1', {});.
In the tutorial you mention, they similarly use <template name="mainLayout">.
That layout template is then appended to your page's body and filled accordingly. You can also change the placeholder for that layout with BlazeLayout.setRoot() by the way.
But strange things may happen if you try to directly target the body? In particular, that may explain why you have content rendered twice.
Original answer:
If your page is actually reloaded, then your router might not be configured properly, as your link is not being intercepted and your browser makes you actually navigate to that page. In that case, we would need to see your actual code if you need further help.
In case your page does not actually reload, but only your whole content is changed (whereas you wanted to change just a part of it), then you should make sure you properly point your dynamic templates.
You can refer to kadira:blaze-layout package doc to see how you set up different dynamic template targets in your layout, and how you can change each of them separately (or several of them simultaneously).
You should have something similar in case you use kadira:react-layout package.

Resources