/**
 * Created by yee.wang on 2019-02-28
 **/ import { MENU_URL } from "../constants/Urls" ; import { menu_data } from "../mock" ; import { wait } from "../utils" ; import { AxiosVmo } from "@vmojs/axios" ; import { Field , mapValue } from "@vmojs/base" ; export default class MenuModel extends AxiosVmo { protected static requestUrl : string = MENU_URL ; @ Field public id : number ; @ Field public parentId : number ; @ Field public level : number ; @ Field public name : string ; @ Field public children : MenuModel [ ] ; public static async get ( ) { await wait ( ) ; return new MenuModel ( menu_data [ 0 ] ) ; } param data public load ( data ) { data . parentId = data . parent_id ; super . load ( data ) ; this . children = mapValue ( data . children , MenuModel ) ; return this ; } }