Skip to content

Instantly share code, notes, and snippets.

@AlexanderHentzsch
Created May 21, 2021 10:03
Show Gist options
  • Save AlexanderHentzsch/dc655de201d9c1afd6a18c358012498a to your computer and use it in GitHub Desktop.
Save AlexanderHentzsch/dc655de201d9c1afd6a18c358012498a to your computer and use it in GitHub Desktop.
Vue.js: Verwendung von v-model auf components
<template>
<div>
<v-text-field v-model="test"></v-text-field>
</div>
</template>
<script>
export default {
name: "child",
props: {
value: Object,
},
data() {
return {
text: ""
};
},
watch: {
"text"() {
this.$emit('input', this.text);
},
},
};
</script>
<template>
<div>
<child v-model="needed"></child>
</div>
</template>
<script>
export default {
name: "parent",
data() {
return {
needed: ""
};
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment