-
-
Notifications
You must be signed in to change notification settings - Fork 32
How to use propertiesmixins js
Charles de Beauchesne edited this page Apr 4, 2019
·
1 revision
This module provide helpers for props definitions.
Example : a lots component will require exactly the same props definitions, let say required document, locale and fields objects. So, here is the code :
// in MyAwesomeComponent.vue
props:{
document:{
type: Object,
required: true
},
locale:{
type: Object,
required: true
},
fields:{
type: Object,
required: true
},
}
And the same for all component that need this boilerplate definition. So, this module declare all definitions that appear in several modules.
Use prop
object that declare property types :
import { requireDocumentProperty, requireFieldProperty } from "@/js/properties-mixins"
//...
mixins : [requireDocumentProperty, requireFieldProperty],
props:{
fields:prop.requiredObject, // "fields" does not have shorthand
}
- 🏠 Home
- 📋 Changelog
- 🛠️ Dev environment
- 🎉 Resolving issues
- 🤖 CI/CD
- 📝 Tech docs
- 🎓 Courses
- 🤓 Admin