Please enable JavaScript.
Coggle requires JavaScript to display documents.
Vue Components - Basic - Coggle Diagram
Vue Components - Basic
Props
Example
passing STATIC value
Parent
<friend-contact name="John" phone-number="0123 4567" email-address="example@mail.com"></friend-contact>
-
Child
props: [ name, phoneNumber, emailAddress]
-
Advanced
props: { isFavorite: { type: String, required: false, default: '0', validator: function(value) { return value === '0' || value === '1'; } }}
-
-
-
-
Emit Events
-
Child
toggleFriend() { this.$emit('toggle-friend', id); }
-
Define Emits
like props, emits: [ 'toggle-friend' ]
-
-
Adding Component
import App from 'App.vue'
import FriendContact from './FriendContact.vue'
const app = CreateApp(App);
app.component('friend-contact', FriendContact);
-
-
-