表达式注解符主要是生成相关的代码来提高开发速度,通常在代码块中使用。

Router

获取一个页面组件路由对象,页面组件路由请的方法只能为GET

语法:@Router(className, [[params=]params])

package views;
import web.components.Component
@Router('/home', id:number=1)
class Home extends Component{
    @Override
    render(){
        const params = {id:5} 
        const route = @Router(views.Home, params); 
        console.log(route.url) //output: /home/5;
        const route2 = @Router(views.Home); 
        console.log(route.url) //output: /home/1;
    }
}

Http

发送Http请求,主要用于在前端页面向后端请求数据

语法:@Http(className, methodName, [[param=]param], [[data=]data], [[options=]options] )

package views;
import web.components.Component
class Home extends Component{
    async loadData(){
        const params = {id:5}
        const data = await @Http(com.api.Person, list, params)
    }
}