Skip to content

Commit

Permalink
fix(router): router内对localstorage的操作加上了try..catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Littly committed Aug 6, 2019
1 parent 6e7f2ab commit a68c5d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/taro-router/src/history/createHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ const tryToParseStore = (state: HistoryState) => {
*/
const createHistorySerializer = (storeObj: HistoryState) => {
let serialize = () => {
localStorage.setItem(defaultStoreKey, JSON.stringify(storeObj))
try {
localStorage.setItem(defaultStoreKey, JSON.stringify(storeObj))
} catch (e) {}
}
serialize()
return serialize
Expand Down

0 comments on commit a68c5d9

Please sign in to comment.