0👍
Use v-model and a watcher like this: (live example)
<script>
export default {
data () {
return {
colorInput: undefined
}
},
watch: {
colorInput(color) {
document.body.style.backgroundColor = color
localStorage.setItem("background", color)
}
},
created() {
this.colorInput = localStorage.getItem("background")
}
}
</script>
<template>
<input type="color" v-model="colorInput">
</template>
Source:stackexchange.com