<template lang="pug">
button(@click="setLocalStorage()")
</template>
export default {
data() {
return {
index: 0
}
},
methods: {
test() {
console.log(1)
},
setLocalStorage() {
localStorage.name += this.index
}
},
created() {
if (process.browser) {
window.addEventListener('storage', this.test)
}
}
}