render()

in src/ui/BaseViewer.tsx [60:82]


  render() {
    return <MContext.Consumer>{
      ctx =>{
        // const isShow = MUtil.isShow(this.props.database, ctx.rootProps.schema?.objectFields, this.props.schema.showIf)
        // // 隐藏的字段不展示
        // if (!isShow) return null
        const childElement = this.element(ctx);
        if(this.props.morph === "readable" || this.state?.noValidate){
          return childElement;
        } else {
          // 加上校验错误提示
          if(!ctx?.forceValid) {
            return childElement;
          }
          const v = assembly.validate(this.props.schema, this.getValue(), this.props.path);
          return [
            childElement,
            v?.message ? <div key="错误提示" className="ant-form-item-explain ant-form-item-explain-error">{v.message}</div> : undefined
          ];
        }
      }
    }</MContext.Consumer>
  }