router_frame.js 471 B

123456789101112131415
  1. export default {
  2. template: "<div><slot></slot></div>",
  3. mounted() {
  4. const initial_path = window.location.pathname;
  5. window.addEventListener("popstate", (event) => {
  6. this.$emit("open", event.state?.page || initial_path);
  7. });
  8. const connectInterval = setInterval(async () => {
  9. if (window.socket.id === undefined) return;
  10. this.$emit("open", window.location.pathname);
  11. clearInterval(connectInterval);
  12. }, 10);
  13. },
  14. props: {},
  15. };