router_frame.js 523 B

123456789101112131415161718
  1. export default {
  2. template: `<div><slot></slot></div>`,
  3. mounted() {
  4. window.addEventListener("popstate", (event) => {
  5. if (event.state && event.state.page) {
  6. this.$emit("open", event.state.page);
  7. }
  8. });
  9. console.log(window.location.pathname);
  10. this.$nextTick(() => {
  11. // FIXME this delay is a hack to make sure the event can actually be handled by the backend
  12. setTimeout(() => {
  13. this.$emit("open", window.location.pathname);
  14. }, 1000);
  15. });
  16. },
  17. props: {},
  18. };