data: () => ({
size: ...
}),
watch: {
size: {
immediate: true,
handler(val) {
fontSize(this.target, val);
},
},
},
<input type="range" v-model="size">
methods: {
onInput(e) {
fontSize(this.target, e.target.value);
},
},
mounted() {
this.$el.querySelector('input').dispatchEvent(new Event('input'));
},
<input type="range" @input="onInput">