3333/**
3434 * VueJS component class
3535 * This class is part of springBoot-VueJS
36+ * Components are create in src/main/resources/static/
3637 * @author jc
3738 * @version 1.0.1
3839 *
@@ -84,10 +85,18 @@ public String getTemplate() {
8485 return template ;
8586 }
8687
88+ /**
89+ * Defines the template string
90+ * @param template
91+ */
8792 public void setTemplate (String template ) {
8893 this .template = template ;
8994 }
9095
96+ /**
97+ * Sets a template file
98+ * @param pathFilename
99+ */
91100 public void setTemplateFile (String pathFilename ) {
92101 try {
93102 loadTemplateFile ("templates/" +pathFilename );
@@ -97,6 +106,9 @@ public void setTemplateFile(String pathFilename) {
97106 }
98107 }
99108
109+ /**
110+ * Sets the default template file (componentName+".html")
111+ */
100112 public void setDefaultTemplateFile () {
101113 setTemplateFile (VueConfig .getTemplateComponentFolder ()+"/" +name +".html" );
102114 }
@@ -105,6 +117,10 @@ public boolean isInternal() {
105117 return internal ;
106118 }
107119
120+ /**
121+ * Defines if the component is created in the vue instance or not
122+ * @param internal
123+ */
108124 public void setInternal (boolean internal ) {
109125 this .internal = internal ;
110126 }
@@ -113,24 +129,48 @@ public VueProps getProps() {
113129 return props ;
114130 }
115131
132+ /**
133+ * Sets the component properties
134+ * @param props
135+ */
116136 public void setProps (String ...props ) {
117137 for (String prop :props ) {
118138 this .props .add (prop );
119139 }
120140 }
121141
142+ /**
143+ * Adds a new property to the component
144+ * @param name The property name
145+ * @param defaultValue The property default value
146+ * @return
147+ */
122148 public VueProp addProp (String name ,Object defaultValue ) {
123149 VueProp prop =this .props .add (name );
124150 prop .setDefaultValue (defaultValue );
125151 return prop ;
126152 }
127153
154+ /**
155+ * Adds a new property to the component
156+ * defaultValue is not quoted (because it's a raw property)
157+ * @param name The property name
158+ * @param defaultValue non quoted value
159+ * @return
160+ */
128161 public VueProp addPropRaw (String name ,String defaultValue ) {
129162 VueProp prop =this .props .add (name );
130163 prop .setDefaultValue (new RawObject (defaultValue ));
131164 return prop ;
132165 }
133166
167+ /**
168+ * Adds a required property to the component
169+ * @param name The property name
170+ * @param type The property type
171+ * @param required true if the property is required
172+ * @return
173+ */
134174 public VueProp addProp (String name ,String type ,boolean required ) {
135175 VueProp prop =this .props .add (name );
136176 prop .setTypes (type );
0 commit comments