-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(reactive): allow scope data to reactive
user can use column or slider slots change data directly (v-model through 3rd components lib) closed #42
- Loading branch information
1 parent
05a8e74
commit d8f582c
Showing
5 changed files
with
46 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<input v-model="dateString" type="date" @input="updateDate" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue'; | ||
const props = defineProps({ | ||
modelValue: { | ||
type: Date, | ||
required: true | ||
} | ||
}); | ||
const emit = defineEmits(['update:modelValue']); | ||
const dateString = computed(() => props.modelValue.toISOString().substr(0, 10)); | ||
function updateDate(event: Event) { | ||
const target = event.target as HTMLInputElement; | ||
const newDate = new Date(target.value); | ||
if (!isNaN(newDate.getTime())) { | ||
emit('update:modelValue', newDate); | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters