document.body.addEventListener(‘touchmove’, function(e) {
e.stopPropagation();//Prevent default events e.preventDefault();//Prevent bubbles });
Open config/index.js, set:
autoOpenBrowser: true,(The default is false, changing false to true.
> some knowledge about hooks:
Using keep-alive, beforeDestroy is not called.Component hooks before destruction) and destroyed (component destruction), because components are not destroyed and cached.
This hook can be seen as an alternative to beforeDestroy, and if you cache a component, you can do something when the component is destroyed, you can put it in this hook.
If you leave the route, it will trigger in turn.
Inside the component, leave the current routing hook beforeRouteLeave => route front guard beforeEach =>Global post hook afterEach => deactivated leaveCache compone...
After we created the mpvue project, we found src/main.js and added a line of code behind it.
(Note: cannot be added before const app = new Vue (App).
Vue.prototype.globalData = getApp().globalData
This line of code means that the global variables of the applet are mounted on the Vue prototype so that we can get the global data on different pages
Different pages can be acquired or modified by this.globalData.
For example, I need to store some basic information of users.
this.globalData.userInfo = {name:aaa}
Different pages get the same way.
console.log(this.globalData.userInfo.name)
modify...