Vtiger Client framework is built on Vuejs and vue framework has components which serves as building blocks in Vtiger. Every page, widget, chart, list in Vtiger is made up of such components. Each component are resuable instance of vue identified with a name. To learn more read this.
In Vtiger we have defined root component VTAP.Component.Core and all other components extend this base component. You can include one component inside another component also.
Component name is divided into 3 parts separated with underscore (_). First is the name of the module where the component would be used, 2nd is fixed term 'Component' and the last part is the your custom name to identify the component. For example if you want to build a custom widget for Contacts module then you should give Contacts_Component_WeatherWidget.
var Contacts_Component_WeatherWidget = VTAP.Component.Core.extend({
});
General structure of a Vtiger component consist of following properties:
There are other properties but we have defined the commonly used ones only here, if you are interested to learn more then you can give this a read. A skeleton structure of a component is shown below.
var Contacts_Component_WeatherWidget = VTAP.Component.Core.extend({
props : {
//add props from the parent
},
data() {
return {
//add your component data variables here
}
},
components :{
//add other child components here if used in templates
},
computed : {
//add computed properties
},
created() {
//add other component registration or listen to vtiger events
//perform ajax request required for your component.
},
mounted() {
//this is called after component is mounted on the DOM
},
template :
`<div>Custom component structure</div>`
});