<script>
let preD = function(e) {
  e.preventDefault();
};

export default {
  data() {
    return {
      searchShow: false
    };
  },
  watch: {
     // Monitor the status of the pop-up box to control whether to disable the page sliding
    searchShow(flag) {
      if (flag) {
        document.body.style.overflow = "hidden";
        document.addEventListener("touchmove", preD, { passive: false }); // Disable page sliding
      } else {
        document.body.style.overflow = ""; // A scroll bar appears
        document.removeEventListener("touchmove", preD, { passive: false}); }}}}; </script>Copy the code

From: www.cnblogs.com/223zzm/p/11…