{ // Schema 参见:https://yuque.antfin-inc.com/mo/spec/spec-materials#eNCJr version: '1.0.0', componentsMap: [ { componentName: 'View', package: 'rax-view', version: '^1.0.0', destructuring: false, exportName: 'View', }, { componentName: 'Text', package: 'rax-text', version: '^1.0.0', destructuring: false, exportName: 'Text', }, { componentName: 'Image', package: 'rax-image', version: '^1.0.0', destructuring: false, exportName: 'Image', }, { componentName: 'Page', package: 'rax-view', version: '^1.0.0', destructuring: false, exportName: 'Page', }, ], componentsTree: [ { componentName: 'Page', fileName: 'home', state: { user: { name: '张三', age: 18, avatar: 'https://gw.alicdn.com/tfs/TB1Ui9BMkY2gK0jSZFgXXc5OFXa-50-50.png' }, orders: [ { title: '【小米智能生活】米家扫地机器人家用全自动扫拖一体机拖地吸尘器', price: 1799, coverUrl: 'https://gw.alicdn.com/tfs/TB1dGVlRfb2gK0jSZK9XXaEgFXa-258-130.png', }, { title: '【限时下单立减】Apple/苹果 iPhone 11 4G全网通智能手机正品苏宁易购官方旗舰店苹果11', price: 4999, coverUrl: 'https://gw.alicdn.com/tfs/TB18gdJddTfau8jSZFwXXX1mVXa-1298-1202.png', }, ], }, props: {}, lifeCycles: {}, methods: { hello: { type: 'JSExpression', value: 'function hello(){ console.log("Hello world!"); }', }, }, dataSource: { list: [ { id: 'urlParams', type: 'urlParams', }, // 示例数据源:https://shs.alibaba-inc.com/mock/1458/demo/user { id: 'user', type: 'fetch', options: { method: 'GET', uri: 'https://shs.alibaba-inc.com/mock/1458/demo/user', }, }, // 示例数据源:https://shs.alibaba-inc.com/mock/1458/demo/orders { id: 'orders', type: 'fetch', options: { method: 'GET', uri: 'https://shs.alibaba-inc.com/mock/1458/demo/orders', }, }, ], }, children: [ { componentName: 'View', children: [ { componentName: 'Text', props: {}, children: 'Demo data source logic', }, ], }, { componentName: 'View', children: [ { componentName: 'Text', props: {}, children: '=== User Info: ===', }, ], }, { componentName: 'View', condition: { type: 'JSExpression', value: 'this.state.user', }, props: { style: { flexDirection: 'row' }, }, children: [ { componentName: 'Image', props: { source: { uri: { type: 'JSExpression', value: 'this.state.user.avatar', }, }, style: { width: '32px', height: '32px', }, }, }, { componentName: 'View', children: [ { componentName: 'Text', children: { type: 'JSExpression', value: 'this.state.user.name', }, }, { componentName: 'Text', children: [ { type: 'JSExpression', value: 'this.state.user.age', }, '岁', ], }, ], }, ], }, { componentName: 'View', children: [ { componentName: 'Text', props: {}, children: '=== Orders: ===', }, ], }, { componentName: 'View', loop: { type: 'JSExpression', value: 'this.state.orders', }, props: { style: { flexDirection: 'row' }, }, children: [ { componentName: 'View', children: [ { componentName: 'Image', props: { source: { uri: { type: 'JSExpression', value: 'this.item.coverUrl', }, }, style: { width: '80px', height: '60px', }, }, }, ], }, { componentName: 'View', children: [ { componentName: 'Text', children: { type: 'JSExpression', value: 'this.item.title', }, }, { componentName: 'Text', children: { type: 'JSExpression', value: 'this.utils.formatPrice(this.item.price, "元")', }, }, ], }, ], }, ], }, ], utils: [ { name: 'formatPrice', type: 'function', content: { type: 'JSFunction', value: 'function formatPrice(price, unit) { return Number(price).toFixed(2) + unit; }', }, }, { name: 'moment', type: 'npm', content: { package: 'moment', version: '*', exportName: 'moment', }, }, { name: 'clone', type: 'npm', content: { package: 'lodash', version: '*', exportName: 'clone', destructuring: false, main: '/clone', }, }, ], config: { sdkVersion: '1.0.3', historyMode: 'hash', targetRootID: 'root', }, meta: { name: 'Rax App Demo', git_group: 'demo-group', project_name: 'demo-project', description: '这是一个示例应用', spma: 'spmademo', creator: '张三', }, }