WeChat public account monitors the return button and clicks the return button to close the page code

mounted() {
    
    
    pushHistory();
    window.addEventListener(
      "popstate",
      function(e) {
    
    
        WeixinJSBridge.call("closeWindow");
      },
      false
    );
    function pushHistory() {
    
    
      var state = {
    
    
        title: "title",
        url: "#"
      };
      window.history.pushState(state, "title", "#");
    }
  },

Guess you like

Origin blog.csdn.net/qq_43248623/article/details/109004943