mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: more updates
This commit is contained in:
@ -3,12 +3,12 @@ vlib/v/checker/tests/vweb_routing_checks.vv:22:1: error: mismatched parameters c
|
||||
21 | ['/bar']
|
||||
22 | pub fn (mut app App) bar(a string) vweb.Result {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
23 | app.vweb.html('works')
|
||||
23 | app.html('works')
|
||||
24 | return vweb.Result{}
|
||||
vlib/v/checker/tests/vweb_routing_checks.vv:29:1: error: mismatched parameters count between vweb method `App.cow` (0) and route attribute ['/cow/:low'] (1)
|
||||
27 | // no segfault, but it shouldnt compile
|
||||
28 | ['/cow/:low']
|
||||
29 | pub fn (mut app App) cow() vweb.Result {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
30 | app.vweb.html('works')
|
||||
30 | app.html('works')
|
||||
31 | return vweb.Result{}
|
||||
|
@ -29,7 +29,7 @@ pub fn (app mut App) index() {
|
||||
pub fn (app App) post() {
|
||||
id := app.get_post_id()
|
||||
post := app.retrieve_post(id) or {
|
||||
app.vweb.redirect('/')
|
||||
app.redirect('/')
|
||||
return
|
||||
}
|
||||
comments := app.find_comments(id)
|
||||
@ -52,7 +52,7 @@ pub fn (app App) post() {
|
||||
@end
|
||||
```
|
||||
|
||||
`$vweb.html()` compiles an HTML template into V during compilation,
|
||||
`$vweb.html()` compiles an HTML template into V during compilation,
|
||||
and embeds the resulting code in current action.
|
||||
|
||||
That means that the template automatically has access to that action's entire environment.
|
||||
|
Reference in New Issue
Block a user