@@ -6,7 +6,7 @@ Insert the dependency in your `pom.xml`file:
66<dependency >
77 <groupId >io.github.jeemv.springboot.vuejs</groupId >
88 <artifactId >springboot-vuejs</artifactId >
9- <version >1.0.2 </version >
9+ <version >[ 1.0,) </version >
1010</dependency >
1111```
1212## Usage
@@ -140,11 +140,11 @@ public class CompoButton {
140140 VueComponent compo= new VueComponent (" button-counter" );
141141 compo. addData(" count" , 0 );
142142 compo. setTemplate(" <button @click=\" count++\" >You clicked me {{ count }} times.</button>" );
143- compo. createFile(" vueJS/button.js " , false );
143+ compo. createFile(false );
144144 }
145145}
146146```
147- The generated file is created in ` {project-folder}/target/classes/static/vueJS/button.js `
147+ The generated file is created in ` {project-folder}/target/classes/static/vueJS/button-counter .js `
148148
149149``` javascript
150150// Script generated with VueComponent at Thu Oct 11 03:01:09 CEST 2018
@@ -161,9 +161,31 @@ Vue.component('button-counter',{
161161Usage:
162162
163163``` html
164+ <script src =" /vueJS/button-counter.js" ></script >
165+ ...
164166<button-counter ></button-counter >
165167```
168+ ### Component with template file
169+ Templates are easier to create in a file:
166170
171+ Create the file ` /src/main/resources/templates/vueJS/button-counter.html `
172+ ``` html
173+ <button @click =" count++" >
174+ You clicked me {{ count }} times.
175+ </button >
176+ ```
177+ Modify the class ` CompoButton ` :
178+ ``` java
179+ public class CompoButton {
180+ public static void main (String [] args ) throws java.lang. Exception {
181+ VueComponent compo= new VueComponent (" button-counter" );
182+ compo. addData(" count" , 0 );
183+ compo. setDefaultTemplateFile();
184+ compo. createFile(false );
185+ }
186+ }
187+ ```
188+ the generated file is the same, but the method is more convenient.
167189
168190## Configuration
169191### VueJS delimiters
0 commit comments