dcos: update site

This commit is contained in:
dntzhang 2019-09-23 11:48:35 +08:00
parent 775ea03f88
commit 2259cbd029
18 changed files with 73 additions and 69 deletions

View File

@ -1,16 +1,16 @@
{
"cn.css": "static/css/cn.4dd07f49.css",
"cn.css.map": "static/css/cn.4dd07f49.css.map",
"cn.js": "static/js/cn.c13167fa.js",
"cn.js.map": "static/js/cn.c13167fa.js.map",
"cn.js": "static/js/cn.a128be5b.js",
"cn.js.map": "static/js/cn.a128be5b.js.map",
"index.css": "static/css/index.4dd07f49.css",
"index.css.map": "static/css/index.4dd07f49.css.map",
"index.js": "static/js/index.700d07ea.js",
"index.js.map": "static/js/index.700d07ea.js.map",
"index.js": "static/js/index.c8b67d99.js",
"index.js.map": "static/js/index.c8b67d99.js.map",
"static/js/0.fa4729fc.chunk.js": "static/js/0.fa4729fc.chunk.js",
"static/js/0.fa4729fc.chunk.js.map": "static/js/0.fa4729fc.chunk.js.map",
"static/js/1.2fa4d5e0.chunk.js": "static/js/1.2fa4d5e0.chunk.js",
"static/js/1.2fa4d5e0.chunk.js.map": "static/js/1.2fa4d5e0.chunk.js.map",
"static/js/1.dcd248e5.chunk.js": "static/js/1.dcd248e5.chunk.js",
"static/js/1.dcd248e5.chunk.js.map": "static/js/1.dcd248e5.chunk.js.map",
"static/js/10.29b8e7af.chunk.js": "static/js/10.29b8e7af.chunk.js",
"static/js/10.29b8e7af.chunk.js.map": "static/js/10.29b8e7af.chunk.js.map",
"static/js/11.1b7cb28d.chunk.js": "static/js/11.1b7cb28d.chunk.js",
@ -29,8 +29,8 @@
"static/js/17.98ec3c54.chunk.js.map": "static/js/17.98ec3c54.chunk.js.map",
"static/js/18.a945affa.chunk.js": "static/js/18.a945affa.chunk.js",
"static/js/18.a945affa.chunk.js.map": "static/js/18.a945affa.chunk.js.map",
"static/js/19.fd07acfe.chunk.js": "static/js/19.fd07acfe.chunk.js",
"static/js/19.fd07acfe.chunk.js.map": "static/js/19.fd07acfe.chunk.js.map",
"static/js/19.13b5520f.chunk.js": "static/js/19.13b5520f.chunk.js",
"static/js/19.13b5520f.chunk.js.map": "static/js/19.13b5520f.chunk.js.map",
"static/js/2.56c4128f.chunk.js": "static/js/2.56c4128f.chunk.js",
"static/js/2.56c4128f.chunk.js.map": "static/js/2.56c4128f.chunk.js.map",
"static/js/20.74ce16c4.chunk.js": "static/js/20.74ce16c4.chunk.js",

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="shortcut icon" href="./favicon.ico"><link rel="stylesheet" href="./highlight/prism.css"><style>*{-webkit-tap-highlight-color:rgba(255,255,255,0);-moz-user-focus:none}</style><title>Omi - Next Front End Framework</title><link href="./static/css/cn.4dd07f49.css" rel="stylesheet"></head><body><script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script><script src="./highlight/prism.js"></script><script src="./js/remarkable.min.js"></script><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="./static/js/cn.c13167fa.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="shortcut icon" href="./favicon.ico"><link rel="stylesheet" href="./highlight/prism.css"><style>*{-webkit-tap-highlight-color:rgba(255,255,255,0);-moz-user-focus:none}</style><title>Omi - Next Front End Framework</title><link href="./static/css/cn.4dd07f49.css" rel="stylesheet"></head><body><script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script><script src="./highlight/prism.js"></script><script src="./js/remarkable.min.js"></script><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="./static/js/cn.a128be5b.js"></script></body></html>

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="shortcut icon" href="./favicon.ico"><link rel="stylesheet" href="./highlight/prism.css"><style>*{-webkit-tap-highlight-color:rgba(255,255,255,0);-moz-user-focus:none}</style><title>Omi - Next Front End Framework</title><link href="./static/css/index.4dd07f49.css" rel="stylesheet"></head><body><script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script><script src="./highlight/prism.js"></script><script src="./js/remarkable.min.js"></script><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="./static/js/index.700d07ea.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="shortcut icon" href="./favicon.ico"><link rel="stylesheet" href="./highlight/prism.css"><style>*{-webkit-tap-highlight-color:rgba(255,255,255,0);-moz-user-focus:none}</style><title>Omi - Next Front End Framework</title><link href="./static/css/index.4dd07f49.css" rel="stylesheet"></head><body><script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script><script src="./highlight/prism.js"></script><script src="./js/remarkable.min.js"></script><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="./static/js/index.c8b67d99.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,37 +13,38 @@ Store is Omi's built-in centralized data warehouse, which solves and provides th
import { render, WeElement, define } from 'omi'
define('my-counter', class extends WeElement {
static use = [
{ count: 'count' }
]
add = () => this.store.add()
sub = () => this.store.sub()
use = ['count', 'adding']
addIfOdd = () => {
if (this.using.count % 2 !== 0) {
if (this.store.data.count % 2 !== 0) {
this.store.add()
}
}
addAsync = () => {
setTimeout(() => this.store.add(), 1000)
this.store.data.adding = true
setTimeout(() => {
this.store.data.adding = false
this.store.add()
}, 1000)
}
render() {
const store = this.store
const { data, add, sub } = store
return (
<p>
Clicked: {this.using.count} times
Clicked: {data.count} times
{' '}
<button onClick={this.add}>+</button>
<button onClick={add}>+</button>
{' '}
<button onClick={this.sub}>-</button>
<button onClick={sub}>-</button>
{' '}
<button onClick={this.addIfOdd}>
<button disabled={data.count % 2 === 0} onClick={this.addIfOdd}>
Add if odd
</button>
{' '}
<button onClick={this.addAsync}>
<button disabled={data.adding} onClick={this.addAsync}>
Add async
</button>
</p>
@ -51,20 +52,21 @@ define('my-counter', class extends WeElement {
}
})
render(<my-counter />, 'body', {
data: {
count: 0
},
sub() {
render(<my-counter />, 'body', new class Store {
data = {
count: 0,
adding: false
}
sub = () => {
this.data.count--
},
add() {
}
add = () => {
this.data.count++
},
}
})
```
* Declare a dependent path by `static use'.
* Declare a dependent path by `use` or `useSelf`(useSelf will update self only, exclude children components).
* `store` injects all components from the root node through the third parameter of render.
Here is a complicated example of `use'.
@ -165,7 +167,7 @@ import '../my-list'
define('my-sidebar', class extends WeElement {
static css = require('./_index.css')
static use = [
use = [
'menus',
'sideBarShow',
'lan'

View File

@ -13,37 +13,38 @@ Store 是 Omi 内置的中心化数据仓库,他解决和提供了下面问题
import { render, WeElement, define } from 'omi'
define('my-counter', class extends WeElement {
static use = [
{ count: 'count' }
]
add = () => this.store.add()
sub = () => this.store.sub()
use = ['count', 'adding']
addIfOdd = () => {
if (this.using.count % 2 !== 0) {
if (this.store.data.count % 2 !== 0) {
this.store.add()
}
}
addAsync = () => {
setTimeout(() => this.store.add(), 1000)
this.store.data.adding = true
setTimeout(() => {
this.store.data.adding = false
this.store.add()
}, 1000)
}
render() {
const store = this.store
const { data, add, sub } = store
return (
<p>
Clicked: {this.using.count} times
Clicked: {data.count} times
{' '}
<button onClick={this.add}>+</button>
<button onClick={add}>+</button>
{' '}
<button onClick={this.sub}>-</button>
<button onClick={sub}>-</button>
{' '}
<button onClick={this.addIfOdd}>
<button disabled={data.count % 2 === 0} onClick={this.addIfOdd}>
Add if odd
</button>
{' '}
<button onClick={this.addAsync}>
<button disabled={data.adding} onClick={this.addAsync}>
Add async
</button>
</p>
@ -51,20 +52,21 @@ define('my-counter', class extends WeElement {
}
})
render(<my-counter />, 'body', {
data: {
count: 0
},
sub() {
render(<my-counter />, 'body', new class Store {
data = {
count: 0,
adding: false
}
sub = () => {
this.data.count--
},
add() {
}
add = () => {
this.data.count++
},
}
})
```
* 通过 `static use` 声明依赖的 path
* 通过 `use` 声明依赖的 path,当然也可以使用 `useSelf``useSelf`触发的更新只会更新自己,不会更新子组件。
* `store` 通过 render 的第三个参数从根节点注入到所有组件。
下面举一个复杂的 `use` 例子。
@ -166,7 +168,7 @@ import '../my-list'
define('my-sidebar', class extends WeElement {
static css = require('./_index.css')
static use = [
use = [
'menus',
'sideBarShow',
'lan'