feat(): 改为vite

This commit is contained in:
2026-03-16 17:58:57 +08:00
parent cd734d8524
commit 1ccbd4e872
74 changed files with 46574 additions and 2145 deletions
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./plugins/visibility";
export { default as VisibilityPlugin } from "./plugins/visibility";
+46
View File
@@ -0,0 +1,46 @@
function install(Vue) {
Vue.mixin({
created() {
const onShowHook = this.$options.onShow;
const onHideHook = this.$options.onHide;
if (onShowHook != null || onHideHook != null) {
this.visibilitychangeCallback();
document.addEventListener(
"visibilitychange",
this.visibilitychangeCallback
);
}
},
destroyed() {
document.removeEventListener(
"visibilitychange",
this.visibilitychangeCallback
);
},
methods: {
visibilitychangeCallback() {
const onShowHook = this.$options.onShow?.bind(this);
const onHideHook = this.$options.onHide?.bind(this);
if (document.visibilityState == "visible") {
console.log("visible");
if (typeof onShowHook === "function") {
onShowHook();
}
}
if (document.visibilityState == "hidden") {
console.log("hidden");
if (typeof onHideHook === "function") {
onHideHook();
}
}
},
},
});
}
export default {
install,
};