Issue of the problems: https://github.com/Meituan-Dianping/mpvue/issues/140
scenes to be used:
In use mpvue development of small procedures, the emergence of the same route multiplexing using different pages of the situation.
E.g:
Enter: Home -> Product Detail Page 1 (id = 1) -> (Recommended Product List Product Details page to enter) product details page 2 (id = 2) -> (Recommended Product List Product Details page to enter) product details page 3 (id = 3)
Return: product details page 3 (id = 3) <- product details page 2 (id = 2) <- Product Details Page 1 (id = 1) <- Home
problem analysis:
By breaking point analysis, the same route at different pages, data data mount, is shared ... has always been an independent data have the same data, rather than each page that is used
Solution :
After the change of use of open source plug-page package: https://github.com/HelloZJW/mpvue-page-factory
Modify mvpue-loader plug-ins as well as increased use of plug-page factory,
Mpvue mpvue-loader according to a modified version of the plug-in package package.json, modified as detailed: https://github.com/jgchenu/mpvue-loader
--package.json "mpvue-loader": "git+https://github.com/HelloZJW/mpvue-loader.git#patch1.0.x", "mpvue-page-factory": "^1.0.0",
You need to modify the re-use routing pages main.js file
import pageFactory from 'mpvue-page-factory'
import App from './index'
Page(pageFactory(App))