npm install @cniot/pageflow``
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
});
ReactDOM.render(
`
- 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
});
ReactDOM.render(
``