一号组件存值
localStorage.setItem('historyPicModal', 'true')
二号组件监听值,写在mounted中即可实时监听localstorage中historyPicModal的变化,event.newValue就是更新后的historyPicModal的值
mounted() {
window.addEventListener('storage', event => {
if(event.key === 'historyPicModal') {
console.log(event.newValue)
}
})
},