Applet page jump pass an array of objects to use JSON.stringify () and JSON.parse ();
JSON.stringify () method is a JavaScript value (object or array) is converted to a string JSON
JSON.parse () method to convert the data to a JavaScript object (character string will be transferred into json objects.)
Transfer page: JSON.stringify by the method, an array or a string object into passed
Received page: the string into the object, and then use
But today face a special situation:
The results JSON.stringify (this.data.totalFuntions) is a correct and complete json string, but the receiving page JSON.parse (options.title) is indeed get a json incomplete data, the reason is because JSON.stringify ( this.data.totalFuntions) which contains the & this character, is intercepted during transmission, the receiving interface only in the front part of it to give
Was conducted in getting the data logic, I am by dividing pageUrl.split ( "?") [0], reserved? Before a string of parameters can be self splicing question mark next interface. (Tips: .replace replacement string ( '/ & / g', '') does not work, I nail applet).
This OK.
Because more details on the time spent, for everyone to share. I wish you can go on the road to smooth some of the applet.
Reproduced in: https: //www.jianshu.com/p/2d23d3189fd4