vuetify
Version:
Vue.js 2 Semantic Component Framework
33 lines (27 loc) • 519 B
text/typescript
import Vue from 'vue'
/* @vue/component */
export default Vue.extend({
name: 'returnable',
props: {
returnValue: null as any
},
data: () => ({
isActive: false,
originalValue: null as any
}),
watch: {
isActive (val) {
if (val) {
this.originalValue = this.returnValue
} else {
this.$emit('update:returnValue', this.originalValue)
}
}
},
methods: {
save (value: any) {
this.originalValue = value
this.isActive = false
}
}
})