Files
WAI_Project_UNIX/cool/index.ts

48 lines
942 B
TypeScript
Raw Permalink Normal View History

2025-08-25 10:07:41 +08:00
import { watch } from "vue";
2025-08-11 23:48:02 +08:00
import { scroller } from "./scroller";
2025-07-21 16:47:04 +08:00
import { initTheme, setH5 } from "./theme";
2025-08-25 10:07:41 +08:00
import { initLocale, locale, updateTitle } from "@/locale";
import "@/uni_modules/cool-ui";
2025-07-21 16:47:04 +08:00
export function cool(app: VueApp) {
app.mixin({
2025-08-11 23:48:02 +08:00
onPageScroll(e) {
scroller.emit(e.scrollTop);
},
2025-07-21 16:47:04 +08:00
onShow() {
2025-08-25 10:07:41 +08:00
// 更新标题
updateTitle();
2025-07-21 16:47:04 +08:00
// #ifdef H5
setTimeout(() => {
setH5();
}, 0);
// #endif
2025-08-25 10:07:41 +08:00
},
onLoad() {
// 监听语言切换,更新标题
watch(locale, () => {
updateTitle();
});
2025-07-21 16:47:04 +08:00
}
});
initTheme();
initLocale();
}
2025-09-08 09:09:38 +08:00
export * from "./animation";
2025-08-11 23:48:02 +08:00
export * from "./ctx";
export * from "./hooks";
2025-07-21 16:47:04 +08:00
export * from "./router";
2025-08-11 23:48:02 +08:00
export * from "./scroller";
2025-07-21 16:47:04 +08:00
export * from "./service";
export * from "./store";
2025-08-11 23:48:02 +08:00
export * from "./theme";
2025-07-21 16:47:04 +08:00
export * from "./upload";
2025-08-11 23:48:02 +08:00
export * from "./utils";
export * from "./types";
2026-01-21 01:37:34 +08:00
export * from "./api";