@cniot/pageflow

1.2.4 • Public • Published

pageflow

GS

  • page
import React from 'react';
import { PageFlowApp, GriffenService, Desktop } from '@cniot/PageFlow";

const service = new GriffenService({
  domain: "https://test-edge.loginx.cainiao.com",
  appId: "10446@pageflow.prog",
  groupId: "bdecff5ce70e42df",
  credentials: "omit",
});

const app = new PageFlowApp({
  service,
  notFoundPagePath: "/system/404",
  showErrorPagePath: "/system/toast",
});


app.registerPage("/firstPage", function(props){
  const {data, onNext} = props;
  // data = {text:"hello world"}
  return <div>
    hello first page
    <button onClick={onNext.bind(server)} >下一步</button>
  </div>;

});

ReactDOM.render(<Desktop app={app} server={service} ></Desktop>, document.getElementById('root'));

  • gs
var nextData = pageFlow.firstPage({
  text:"hello world"
});

纯前端

  • 业务流程 flow.js
import {UserInterface} from '@cniot/pageflow';


export const appId = "hello";
export function onStart(){
  const code = await UI.router("/pages/scanDesk", {title:"请扫描"});
  console.log("code", code); // 123
}

const UI = new UserInterface({
  appId
});


  • 页面
import React from 'react';
import { PageFlowApp, WebService, Desktop } from '@cniot/PageFlow";
import {appId, onStart} from './flow.js';

const service = new WebService({
  appId,
  onStart
});

const app = new PageFlowApp({
  service,
  notFoundPagePath: "/system/404",
  showErrorPagePath: "/system/toast",
});


app.registerPage("/pages/scanDesk", function(props){
  const {data, onNext} = props;
  // data = {title:"请扫描"}
  return <div>
    hello first page
    <button onClick={()=> onNext(123)} >下一步</button>
  </div>;

});

ReactDOM.render(<Desktop app={app} server={service} ></Desktop>, document.getElementById('root'));

Readme

Keywords

none

Package Sidebar

Install

npm i @cniot/pageflow

Weekly Downloads

1

Version

1.2.4

License

ISC

Unpacked Size

64.4 kB

Total Files

7

Last publish

Collaborators

  • hxuena
  • lanjian.yj
  • qige.yzx
  • mingnan.wmn
  • xiaobc
  • wangyuhao.wyh
  • rio7
  • wukidy
  • jun.lu
  • zhouhuan