mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
Update the nuxt3 version. Co-authored-by: Jonathan Adeline <jonathan@baserow.io> Co-authored-by: Bram Wiepjes <bramw@protonmail.com> Co-authored-by: Cezary <cezary@baserow.io> Co-authored-by: Tsering Paljor <tsering@baserow.io> Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io> Co-authored-by: Bram <bram2w@users.noreply.github.com>
60 lines
1.1 KiB
Vue
60 lines
1.1 KiB
Vue
<template>
|
|
<input
|
|
v-model="inputValue"
|
|
v-bind="$attrs"
|
|
class="preview-navigation-bar-input"
|
|
:class="{
|
|
'preview-navigation-bar-input--invalid': invalidValueForType,
|
|
}"
|
|
/>
|
|
</template>
|
|
|
|
<script>
|
|
import _ from 'lodash'
|
|
|
|
export default {
|
|
inheritAttrs: false,
|
|
props: {
|
|
defaultValue: {
|
|
type: [String, Number, Array],
|
|
required: false,
|
|
default: '',
|
|
},
|
|
validationFn: {
|
|
type: Function,
|
|
required: true,
|
|
},
|
|
},
|
|
emits: ['change'],
|
|
data() {
|
|
return {
|
|
value: this.defaultValue,
|
|
invalidValueForType: false,
|
|
}
|
|
},
|
|
computed: {
|
|
inputValue: {
|
|
get() {
|
|
return this.value
|
|
},
|
|
set(inputValue) {
|
|
this.invalidValueForType = false
|
|
this.value = inputValue
|
|
try {
|
|
this.$emit('change', this.validationFn(this.value))
|
|
} catch (error) {
|
|
this.invalidValueForType = true
|
|
}
|
|
},
|
|
},
|
|
},
|
|
watch: {
|
|
defaultValue(newValue) {
|
|
if (!_.isEqual(this.inputValue, newValue)) {
|
|
this.inputValue = newValue
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|