简体   繁体   English

Total.js自定义系统视图

[英]Total.js Custom System View

I would like to use controller.view500(err) and display a custom system view. 我想使用controller.view500(err)并显示一个自定义系统视图。

How to display a custom system view 500, 400 ? 如何显示自定义系统视图500、400?

https://docs.totaljs.com/latest/en.html#api~FrameworkController~controller.view https://docs.totaljs.com/latest/en.html#api~FrameworkController~controller.view

Thank you 谢谢

The function view500 doesn't actually render any view. 函数view500实际上并不呈现任何视图。 It's just an alias for throw500. 它只是throw500的别名。

If you want to render a view you can define a custom route like this: 如果要渲染视图,可以定义一个自定义路线,如下所示:

F.route('#500', function(){
    // You need to create the view '500.html' file yourself in views folder
    this.view('500');
});

Then whenever you use controller.view500(); 然后,无论何时使用controller.view500(); the above route will handle it. 以上路线即可处理。 The error you pass to view500 should be available in the route controller as controller.exception 您传递给view500的错误应在路径控制器中作为controller.exception

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM