chore: add demo

This commit is contained in:
wuji.xwt 2020-06-21 17:53:20 +08:00
parent 7db1378fad
commit aaf6359a8d
14 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,35 @@
import { createElement, render } from 'rax';
import DriverUniversal from 'driver-universal';
import View from 'rax-view';
import Text from 'rax-text';
import { Engine } from '../src/index';
const components = {
View,
Text,
};
const schema = {
componentName: 'Page',
fileName: 'home',
props: {},
children: [
{
componentName: 'View',
props: {},
children: [
{
componentName: 'Text',
props: {
type: 'primary',
},
children: ['Welcome to Your Rax App!'],
},
],
},
],
};
render(<Engine schema={schema} components={components} />, document.getElementById('root'), {
driver: DriverUniversal,
});

View File

@ -0,0 +1 @@
App({});

View File

@ -0,0 +1,6 @@
{
"pages": ["pages/index"],
"window": {
"defaultTitle": "demo"
}
}

View File

@ -0,0 +1 @@
<my-component></my-component>

View File

@ -0,0 +1,4 @@
Page({
onLoad() {},
onShow() {}
});

View File

@ -0,0 +1,6 @@
{
"defaultTitle": "Miniapp Rax Text demo",
"usingComponents": {
"my-component": "../components/Target/index"
}
}

View File

@ -0,0 +1 @@
App({});

View File

@ -0,0 +1,6 @@
{
"pages": ["pages/index"],
"window": {
"title": "demo"
}
}

View File

@ -0,0 +1,4 @@
Page({
onLoad() {},
onShow() {}
});

View File

@ -0,0 +1,6 @@
{
"title": "Wechat MiniProgram Rax Text demo",
"usingComponents": {
"my-component": "../components/Target/index"
}
}

View File

@ -0,0 +1 @@
<my-component></my-component>

View File

@ -54,7 +54,8 @@
},
"devDependencies": {
"@alib/build-scripts": "^0.1.0",
"build-plugin-rax-component": "^0.1.4"
"build-plugin-rax-component": "^0.1.4",
"driver-universal": "^3.1.3"
},
"publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com"