53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
/*
|
||
* Copyright (c) 2020. bmy
|
||
* Email:2271608011@qq.com
|
||
* Github:https://github.com/helpcode
|
||
*/
|
||
import { Autowired } from "@ann/ioc.annotation";
|
||
import { UserService, ResponseType } from "@service/user.service";
|
||
import { BaseLogic } from "@logic/base.logic";
|
||
import { Methods, VueCustomize } from "@logic/base.type";
|
||
|
||
export class HomeLogic<T extends VueCustomize> extends BaseLogic<T> implements Methods {
|
||
|
||
@Autowired()
|
||
public readonly UserService!: UserService;
|
||
|
||
public title: string = "12222";
|
||
|
||
public List: ResponseType[] = [
|
||
{ user_id: 1, user_name: '测试1' },
|
||
{ user_id: 2, user_name: '测试2' },
|
||
];
|
||
|
||
constructor() {
|
||
super();
|
||
}
|
||
|
||
/**
|
||
* 页面初始化调用的方法
|
||
*/
|
||
public async StartUp(): Promise<void> {
|
||
// 在StartUp方法中访问$route和$router
|
||
console.log("StartUp - this: ", this);
|
||
console.log("StartUp - this.$route: ", this.$route);
|
||
console.log("StartUp - this.$router: ", this.$router);
|
||
|
||
await this.getData();
|
||
}
|
||
|
||
/**
|
||
* 请求首页数据
|
||
*/
|
||
public async getData(): Promise<void> {
|
||
// this.List = await this.UserService.UserList({ type: 1, page: 1 });
|
||
// console.log("this.List: ", this.List);
|
||
|
||
// let res = await this.UserService.login({ type: 2, page: 2 });
|
||
// console.log("this.res: ", res);
|
||
|
||
//
|
||
// await this._.$router.push('/About')
|
||
}
|
||
}
|