wip
This commit is contained in:
		
							parent
							
								
									6544916b0c
								
							
						
					
					
						commit
						dc7b9d782f
					
				
					 4 changed files with 17 additions and 17 deletions
				
			
		|  | @ -46,7 +46,7 @@ export default defineComponent({ | |||
| 		FormButton, | ||||
| 	}, | ||||
| 	props: { | ||||
| 		value: { | ||||
| 		modelValue: { | ||||
| 			required: false | ||||
| 		}, | ||||
| 		type: { | ||||
|  | @ -104,8 +104,8 @@ export default defineComponent({ | |||
| 	}, | ||||
| 	emits: ['change', 'keydown', 'enter'], | ||||
| 	setup(props, context) { | ||||
| 		const { value, type, autofocus } = toRefs(props); | ||||
| 		const v = ref(value.value); | ||||
| 		const { modelValue, type, autofocus } = toRefs(props); | ||||
| 		const v = ref(modelValue.value); | ||||
| 		const id = Math.random().toString(); // TODO: uuid? | ||||
| 		const focused = ref(false); | ||||
| 		const changed = ref(false); | ||||
|  | @ -131,13 +131,13 @@ export default defineComponent({ | |||
| 		const updated = () => { | ||||
| 			changed.value = false; | ||||
| 			if (type?.value === 'number') { | ||||
| 				context.emit('update:value', parseFloat(v.value)); | ||||
| 				context.emit('update:modelValue', parseFloat(v.value)); | ||||
| 			} else { | ||||
| 				context.emit('update:value', v.value); | ||||
| 				context.emit('update:modelValue', v.value); | ||||
| 			} | ||||
| 		}; | ||||
| 
 | ||||
| 		watch(value, newValue => { | ||||
| 		watch(modelValue.value, newValue => { | ||||
| 			v.value = newValue; | ||||
| 		}); | ||||
| 
 | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ import './debobigego.scss'; | |||
| 
 | ||||
| export default defineComponent({ | ||||
| 	props: { | ||||
| 		value: { | ||||
| 		modelValue: { | ||||
| 			required: false | ||||
| 		}, | ||||
| 		required: { | ||||
|  | @ -51,10 +51,10 @@ export default defineComponent({ | |||
| 	computed: { | ||||
| 		v: { | ||||
| 			get() { | ||||
| 				return this.value; | ||||
| 				return this.modelValue; | ||||
| 			}, | ||||
| 			set(v) { | ||||
| 				this.$emit('update:value', v); | ||||
| 				this.$emit('update:modelValue', v); | ||||
| 			} | ||||
| 		}, | ||||
| 	}, | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ import './debobigego.scss'; | |||
| 
 | ||||
| export default defineComponent({ | ||||
| 	props: { | ||||
| 		value: { | ||||
| 		modelValue: { | ||||
| 			type: Boolean, | ||||
| 			default: false | ||||
| 		}, | ||||
|  | @ -40,13 +40,13 @@ export default defineComponent({ | |||
| 	}, | ||||
| 	computed: { | ||||
| 		checked(): boolean { | ||||
| 			return this.value; | ||||
| 			return this.modelValue; | ||||
| 		} | ||||
| 	}, | ||||
| 	methods: { | ||||
| 		toggle() { | ||||
| 			if (this.disabled) return; | ||||
| 			this.$emit('update:value', !this.checked); | ||||
| 			this.$emit('update:modelValue', !this.checked); | ||||
| 		} | ||||
| 	} | ||||
| }); | ||||
|  |  | |||
|  | @ -34,7 +34,7 @@ export default defineComponent({ | |||
| 		FormButton, | ||||
| 	}, | ||||
| 	props: { | ||||
| 		value: { | ||||
| 		modelValue: { | ||||
| 			required: false | ||||
| 		}, | ||||
| 		required: { | ||||
|  | @ -74,8 +74,8 @@ export default defineComponent({ | |||
| 		}, | ||||
| 	}, | ||||
| 	setup(props, context) { | ||||
| 		const { value } = toRefs(props); | ||||
| 		const v = ref(value.value); | ||||
| 		const { modelValue } = toRefs(props); | ||||
| 		const v = ref(modelValue.value); | ||||
| 		const changed = ref(false); | ||||
| 		const inputEl = ref(null); | ||||
| 		const focus = () => inputEl.value.focus(); | ||||
|  | @ -86,10 +86,10 @@ export default defineComponent({ | |||
| 
 | ||||
| 		const updated = () => { | ||||
| 			changed.value = false; | ||||
| 			context.emit('update:value', v.value); | ||||
| 			context.emit('update:modelValue', v.value); | ||||
| 		}; | ||||
| 
 | ||||
| 		watch(value, newValue => { | ||||
| 		watch(modelValue.value, newValue => { | ||||
| 			v.value = newValue; | ||||
| 		}); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue