Answers for "custom v-model vue"

1

use v-model in custom component

/******************/
/* CUSTOM ELEMENT */
/******************/
<template>
	<!-- Everithing you whant -->
	<input :value="value" @input="$emit('input',$event.target.value)"/>
</template>

<script>
export default {
	name: "CustomElement",
	props: {
    	value: {
			type: String,
			default: ""
		}
	}
}
</script>

/******************/
/* PARENT ELEMENT */
/******************/
<CustomElement v-model="someVariable" />
Posted by: Guest on September-05-2021
9

vue v-model

<input v-model="message" placeholder="edit me">
<p>Message is: {{ message }}</p>
Posted by: Guest on March-04-2020

Browse Popular Code Answers by Language