Skip to content

Commit

Permalink
Merge pull request #26 from Houfeng/modeInitialize
Browse files Browse the repository at this point in the history
mota@3.5.1
  • Loading branch information
Houfeng authored Oct 8, 2019
2 parents 2c8333e + c4e6dc6 commit c02f967
Show file tree
Hide file tree
Showing 20 changed files with 725 additions and 507 deletions.
2 changes: 1 addition & 1 deletion dist/mota-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mota-min.js.map

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions dist/mota.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mota.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data.js

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
<link href="./assets/index.css" rel="stylesheet"><link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
<title>Mota</title>
<meta name="keywords" content="Mota" />
<meta name="description" content="Mota" />
<meta name="author" content="doczilla">
<base href="." route="" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script type="text/javascript" src="./assets/index.js"></script><script src="./plugins/doczilla-highlight/index.js"></script></body>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
Binary file added docs/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions docs/zh/guide/autorun.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>自执行函数 - Mota</title>
<meta name="keywords" content="自执行函数" />
<meta name="description" content="自执行函数" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22autorun%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
24 changes: 24 additions & 0 deletions docs/zh/guide/binding.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>数据绑定 - Mota</title>
<meta name="keywords" content="数据绑定" />
<meta name="description" content="数据绑定" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22binding%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
24 changes: 24 additions & 0 deletions docs/zh/guide/hook_model.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>面向 Hook 的模型 - Mota</title>
<meta name="keywords" content="面向 Hook 的模型" />
<meta name="description" content="面向 Hook 的模型" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22hook_model%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
24 changes: 24 additions & 0 deletions docs/zh/guide/mapping.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>属性映射 - Mota</title>
<meta name="keywords" content="属性映射" />
<meta name="description" content="属性映射" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22mapping%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
24 changes: 24 additions & 0 deletions docs/zh/guide/model.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>编写业务模型 - Mota</title>
<meta name="keywords" content="编写业务模型" />
<meta name="description" content="编写业务模型" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22model%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
24 changes: 24 additions & 0 deletions docs/zh/guide/quick.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>快速开始 - Mota</title>
<meta name="keywords" content="快速开始" />
<meta name="description" content="快速开始" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22quick%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
24 changes: 24 additions & 0 deletions docs/zh/guide/typescript.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>在 TS 中使用 - Mota</title>
<meta name="keywords" content="在 TS 中使用" />
<meta name="description" content="在 TS 中使用" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22typescript%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
24 changes: 24 additions & 0 deletions docs/zh/guide/use_model.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>使用 Hook API - Mota</title>
<meta name="keywords" content="使用 Hook API" />
<meta name="description" content="使用 Hook API" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22use_model%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
24 changes: 24 additions & 0 deletions docs/zh/guide/watch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>监听模型变化 - Mota</title>
<meta name="keywords" content="监听模型变化" />
<meta name="description" content="监听模型变化" />
<meta name="author" content="doczilla">
<base href="../../" route="%7B%22lang%22%3A%22zh%22%2C%22group%22%3A%22guide%22%2C%22doc%22%3A%22watch%22%7D" />
<link href="./assets/index.css" rel="stylesheet">
<link href="./plugins/doczilla-card/index.css" rel="stylesheet" /><link href="./plugins/doczilla-details/index.css" rel="stylesheet" /><link href="./plugins/doczilla-highlight/index.css" rel="stylesheet" /></head>
</head>

<body>
<div id="root"></div>
<script src="./data.js"></script>
<script src="./assets/index.js"></script>
<script src="./plugins/doczilla-highlight/index.js"></script></body>
</body>

</html>
15 changes: 5 additions & 10 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { model } from '../src';
import { useModel } from '../src';
import { HashRouter as Router, Route, Link } from "react-router-dom";
import { A } from "./components/A";
import { B } from "./components/B";
import { D } from "./components/D";
import './assets/common.less';
import { Info } from './model/info';
import { binding } from '../src/binding';
import './assets/common.less';

function App() {
const model = useModel(model);
Expand All @@ -17,14 +12,14 @@ function App() {
</div>;
}

@model(Info)
@model({ name: 'test' })
@binding
class Test extends React.PureComponent {
onClick = () => {
this.model.name = '1111';
static modeInitialize(model, props) {
console.log('modeInitialize', model, props);
}
render() {
return <div onClick={this.onClick}>
return <div>
{this.model.name}
<input data-bind="name" />
</div>
Expand Down
Loading

0 comments on commit c02f967

Please sign in to comment.