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
Copy file name to clipboardExpand all lines: README.md
+28-10Lines changed: 28 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,31 @@ Mustache view use double mustache for variables (message in the example), so the
45
45
46
46
The `vue` variable generates the javascript code for the view instance creation. The triple mustache `{{{vue}}}`is use for javascript/html code unescaping.
47
47
48
+
#### With @AutoWired annotation
49
+
This technique has the advantage of providing a globale instance of view JS for all the actions of a controller:
50
+
```java
51
+
@Controller
52
+
@RequestMapping("/ui/")
53
+
publicclassUiTest {
54
+
55
+
@AutoWired
56
+
privateWueJS vue;
57
+
58
+
@GetMapping("test")
59
+
publicStringindex(ModelMapmodel) {
60
+
vue.addData("message", "Hello world!");
61
+
model.put("vue", vue);
62
+
return"index";
63
+
}
64
+
}
65
+
```
66
+
In this case, you can directly configure **VueJS** in the **application.properties** file:
0 commit comments