UNPKG

mutants-appfx

Version:

appfx module

43 lines (35 loc) 818 B
import { observable, action, } from 'mobx'; import { assignId } from './util'; export default class ViewBase { store; key; @observable name; get type(){ return this.__proto__.constructor._tname || 'ViewBase'; } constructor(store, name) { this.store = store; this.key = assignId(); this.name = name || (this.__proto__.constructor._tname || 'ViewBase') + this.key; } @action async triggerFieldInput(fieldNames, context, args){ // 需要具体的VM实现字段录入交互 } @action async triggerFeedback(message, type){ // 需要具体的VM实现用户反馈交互 } toJS() { return { name: this.name } } static fromJS(store, config) { //return new ViewBase(store, store.loadMetadata(config)); throw Error('need to rewrite'); } }