Created
June 6, 2023 01:59
-
-
Save jarrodhroberson/b6cb706a73e2ac856f8c9330a0eb2d33 to your computer and use it in GitHub Desktop.
Reactive Component Vue 3
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
<script setup> | |
import { ref } from 'vue' | |
import CustomInput from './CustomInput.vue' | |
const messages = ref([]) | |
messages.value.push({channel: { title: "Jarrod Roberson"}}) | |
messages.value.push({channel: { title: "Julian Roberson"}}) | |
messages.value.push({channel: { title: "Sebastian Roberson"}}) | |
messages.value.push({channel: { title: "Valentino Roberson"}}) | |
</script> | |
<template> | |
<div v-for='(message, idx) in messages' :key='idx'> | |
<CustomInput v-model="messages[idx].channel.title" /> {{ message.channel.title }} | |
</div> | |
</template> |
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
<script setup> | |
defineProps(['modelValue']) | |
defineEmits(['update:modelValue']) | |
</script> | |
<template> | |
<input | |
:value="modelValue" | |
@input="$emit('update:modelValue', $event.target.value)" | |
/> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment