♻️ better types system

This commit is contained in:
2019-01-22 12:52:22 +01:00
parent 6394f2a869
commit abd29d2999
27 changed files with 635 additions and 300 deletions

View File

@@ -1,6 +1,6 @@
<template>
<input
v-model="value.value"
v-model="value"
:type="
type === 'Number' ? 'number' :
type === 'Color' ? 'color' :
@@ -11,7 +11,7 @@
<script>
export default {
props: {
value: {
io: {
type: null,
required: true,
},
@@ -19,6 +19,26 @@ export default {
type: String,
required: true,
}
},
computed: {
value: {
get() {
return this.io.value;
},
set(val) {
if (this.type === 'Number') {
this.io.value = parseFloat(val)
} else {
this.io.value = val;
}
}
}
},
methods: {
onChange($event) {
console.log('change', $event);
this.value = $event.target.value;
}
}
}
</script>