You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
props: {title: String,likes: Number,isPublished: Boolean,commentIds: Array,author: Object,callback: Function,contactsPromise: Promise// or any other constructor}
Vue.component('my-component',{props: {// Basic type check (`null` and `undefined` values will pass any type validation)propA: Number,// Multiple possible typespropB: [String,Number],// Required stringpropC: {type: String,required: true},// Number with a default valuepropD: {type: Number,default: 100},// Object with a default valuepropE: {type: Object,// Object or array defaults must be returned from// a factory functiondefault: function(){return{message: 'hello'}}},// Custom validator functionpropF: {validator: function(value){// The value must match one of these stringsreturn['success','warning','danger'].indexOf(value)!==-1}}}})
vue & components & props & methods & callback
solution 1 & props & data
solution 2 &
this.$emit()
https://vuejs.org/v2/guide/components-props.html
https://michaelnthiessen.com/pass-function-as-prop
not too good
good
slot
https://adamwathan.me/the-trick-to-understanding-scoped-slots-in-vuejs/
https://vuejsdevelopers.com/2018/07/30/callback-props-vs-emitting-events/
https://medium.com/front-end-weekly/passing-methods-as-props-in-vue-js-d65805bccee
events
https://vuejs.org/v2/guide/events.html
https://cn.vuejs.org/v2/guide/events.html
Event-Modifiers
https://vuejs.org/v2/guide/events.html#Event-Modifiers
Key-Modifiers
https://vuejs.org/v2/guide/events.html#Key-Modifiers
System-Modifier-Keys
https://vuejs.org/v2/guide/events.html#System-Modifier-Keys
Components Basics
https://vuejs.org/v2/guide/components.html
The text was updated successfully, but these errors were encountered: