0.0.7 • Published 4 years ago
herb-plugin-class v0.0.7
herb-plugin-class
Usage
Page
import { Page } from 'herbjs';
import { D, P, PImpls } from 'herb-plugin-class';
interface IStoreState {
visible: boolean;
style: Record<any, any>;
}
interface IStoreGetters {
users?: Array<{
name: string;
address: string;
}>;
}
interface IStoreMutations {
updateState(s: any, payload: number): any;
}
interface IStoreActions {
beforeRender(ctx: any, payload: string): any;
}
export interface PageStore {
state: IStoreState;
getters: IStoreGetters;
mutations: IStoreMutations;
actions: IStoreActions;
}
export interface Data {
what: number;
hello: string[];
}
export interface Methods {
onRun?(s: number): string;
onHH(s: number): number;
}
@D
class S extends P<Data, Methods, PageStore> implements PImpls<Data, Methods> {
data: Data = {
what: 1,
hello: [],
}
onLoad() {
}
onHH() {
return 1;
}
onRun(g: number) {
return g + '';
}
}
Page(S);