WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2023-07-31 ad01ea7d8ea42d9df787b6847c2d4272c5740c5b
bases/Pilot.js
@@ -4,8 +4,7 @@
 */
import Taro, { getCurrentInstance, getCurrentPages } from '@tarojs/taro';
import { Fetcher } from './Fetcher';
import { Tools } from '@components/common/Tools';
import { $hostBoot } from '@components/bases/HostBoot';
import project from '@project';
export class Pilot {
@@ -92,6 +91,8 @@
    // 创建页面通讯器
    static createPoster($vm) {
        return (pageType, action, data) => {
            // 解除引用关系
            const nextData = JSON.parse(JSON.stringify(data || {}));
            // 下一页
            if (pageType === 'nextPage') {
                // 持续 3 秒,检测下一页是否存在
@@ -105,7 +106,7 @@
                    const nextPage = currentPages[pageIndex + 1];
                    if (nextPage) {
                        clearInterval(timer);
                        nextPage.$component.$onMessage(action, data);
                        nextPage.$component.$onMessage(action, nextData);
                    }
                }, 50);
            } else if (pageType === 'prevPage') {
@@ -113,12 +114,12 @@
                const pageIndex = currentPages.findIndex(page => page.$component === $vm);
                const prevPage = currentPages[pageIndex - 1];
                if (prevPage) {
                    prevPage.$component.$onMessage(action, data);
                    prevPage.$component.$onMessage(action, nextData);
                }
            } else if (pageType === 'rootPage') {
                const currentPages = getCurrentPages();
                const rootPage = currentPages[0];
                rootPage.$component.$onMessage(action, data);
                rootPage.$component.$onMessage(action, nextData);
            }
        };
    }
@@ -143,7 +144,7 @@
            }
            // 小程序
            else if (process.env.TARO_ENV === 'weapp') {
                assets2[key] = Fetcher.host + project.host.assetsPath + asset;
                assets2[key] = $hostBoot.getHost() + project.host.assetsPath + asset;
            }
        });
        return assets2;