window.localStorage.getItem获取出来的值不对

## 设置localStorage,类型Number


## 另一个页面mounted中获取,发现不一样

        mounted() {

            this.temp = window.localStorage.getItem('moveWidth')         

            console.error("temp",typeof this.temp ,this.temp)

        },

## 打印结果

## 解决方法

1、在设置localStorage那里,发现存在数字字符串相加。parseInt

2、获取代码放在this.$nextTick()中

你可能感兴趣的:(window.localStorage.getItem获取出来的值不对)