feat: 完成模板预览隔离与矩阵验收
This commit is contained in:
1 parent
d38dbe02aa
commit
5bf54096be
13 files changed
+287
-19
No files matched your search
@@ -2,13 +2,27 @@ import React from "react";
|
||||
const noop = () => Promise.resolve();
|
||||
export const useRouter = () => ({ params: {} });
|
||||
export const useDidShow = (callback) => React.useEffect(callback, []);
|
||||
// Admin 画布监听该事件完成画布内路由;真实 Taro 端仍使用原始 API。
|
||||
const emitPreviewNavigation = (method, options) => {
|
||||
if (typeof window === "undefined") return;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("template-preview-navigate", { detail: { method, options } }),
|
||||
);
|
||||
};
|
||||
|
||||
const Taro = {
|
||||
setStorageSync() {},
|
||||
getStorageSync() {
|
||||
return undefined;
|
||||
},
|
||||
removeStorageSync() {},
|
||||
switchTab: noop,
|
||||
navigateTo: noop,
|
||||
switchTab(options) {
|
||||
emitPreviewNavigation("switchTab", options);
|
||||
return Promise.resolve();
|
||||
},
|
||||
navigateTo(options) {
|
||||
emitPreviewNavigation("navigateTo", options);
|
||||
return Promise.resolve();
|
||||
},
|
||||
};
|
||||
export default Taro;
|
||||
Reference in new issue
Block a user