@cniot/pageflow
v1.2.4
Published
Downloads
74
Keywords
Readme
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: "[email protected]",
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'));