1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-27 20:32:21 +00:00

问题修改

你好,阮老师,在282行的例子中,我使用新版本chrome 测试了例子,出现了错误

发现const dom 产生了暂时性死区

如理解有误,浪费了老师时间,望见谅
This commit is contained in:
Owen 2016-05-18 14:22:59 +08:00
parent 307932e155
commit 37db7edecf

View File

@ -279,19 +279,6 @@ pipe(3).double.pow.reverseInt.get; // 63
下面的例子则是利用`get`拦截实现一个生成各种DOM节点的通用函数`dom`
```javascript
const el = dom.div({},
'Hello, my name is ',
dom.a({href: '//example.com'}, 'Mark'),
'. I like:',
dom.ul({},
dom.li({}, 'The web'),
dom.li({}, 'Food'),
dom.li({}, '…actually that\'s it')
)
);
document.body.appendChild(el);
const dom = new Proxy({}, {
get(target, property) {
return function(attrs = {}, ...children) {
@ -309,6 +296,19 @@ const dom = new Proxy({}, {
}
}
});
const el = dom.div({},
'Hello, my name is ',
dom.a({href: '//example.com'}, 'Mark'),
'. I like:',
dom.ul({},
dom.li({}, 'The web'),
dom.li({}, 'Food'),
dom.li({}, '…actually that\'s it')
)
);
document.body.appendChild(el);
```
### set()