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(options) { emitPreviewNavigation("switchTab", options); return Promise.resolve(); }, navigateTo(options) { emitPreviewNavigation("navigateTo", options); return Promise.resolve(); }, }; export default Taro;