0.0.7 • Published 4 years ago

herb-plugin-class v0.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

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);
0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago