GalaxyMeteor 2024-11-04 15:12 采纳率: 20%
浏览 4
已结题

前端MUI框架的跳转问题

在mui框架中使用mui.back()从当前页面B返回上一个页面A时,如何实现返回页面A后执行一个函数,已知使用了以下方式都无法实现

mui.plusReady(function () {
                let current = plus.webview.currentWebview()
                    current.addEventListener('show', function(){
                        get()
                    })
            })
            window.addEventListener('pageshow', function(e){
                if(e.persisted){
                    get()
                }
            })
            document.addEventListener("visibilitychange", function () {
                if (document.visibilityState === "visible") {
                    // 页面重新可见时触发的事件
                    console.log("返回页面并重新可见");
                    // 在这里调用你想执行的函数
                   get();
                }
            });
            window.addEventListener("pageshow", function (event) {
                if (event.persisted || performance.getEntriesByType("navigation")[0].type === "back_forward") {
                    // 当页面通过浏览器的后退按钮显示时触发
                    console.log("返回页面并重新显示");
                    // 在这里调用你想执行的函数
                    get();
                }
            });

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 已结题 (查看结题原因) 11月4日
    • 创建了问题 11月4日