Skip to content

Commit

Permalink
文档更新
Browse files Browse the repository at this point in the history
  • Loading branch information
bplok20010 committed Jun 14, 2020
1 parent 64b0e57 commit c87982c
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
npm install --save vue-toy
```

300行左右代码模拟vue实现
200行左右代码模拟vue实现

[![Edit vibrant-williamson-66cdi](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/vibrant-williamson-66cdi?fontsize=14&hidenavigation=1&theme=dark)

Expand Down
6 changes: 3 additions & 3 deletions docs/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"index.css": "static/css/index.f755b670.chunk.css",
"index.js": "static/js/index.f755b670.chunk.js",
"index.css": "static/css/index.ccfed814.chunk.css",
"index.js": "static/js/index.ccfed814.chunk.js",
"runtime-index.js": "static/js/runtime-index.92eae014.js",
"static/js/2.bee63abf.chunk.js": "static/js/2.bee63abf.chunk.js",
"static/js/2.33097d03.chunk.js": "static/js/2.33097d03.chunk.js",
"index.html": "index.html"
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><meta charset="utf-8"/><title>Vue toy</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"/><style></style><link href="static/css/index.f755b670.chunk.css" rel="stylesheet"></head><body><div class="demo" id="demo"></div><script src="static/js/runtime-index.92eae014.js"></script><script src="static/js/2.bee63abf.chunk.js"></script><script src="static/js/index.f755b670.chunk.js"></script></body></html>
<!doctype html><html><head><meta charset="utf-8"/><title>Vue toy</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"/><style></style><link href="static/css/index.ccfed814.chunk.css" rel="stylesheet"></head><body><div class="demo" id="demo"></div><script src="static/js/runtime-index.92eae014.js"></script><script src="static/js/2.33097d03.chunk.js"></script><script src="static/js/index.ccfed814.chunk.js"></script></body></html>
File renamed without changes.
1 change: 1 addition & 0 deletions docs/static/js/2.33097d03.chunk.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/static/js/2.bee63abf.chunk.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/static/js/index.ccfed814.chunk.js

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

1 change: 0 additions & 1 deletion docs/static/js/index.f755b670.chunk.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-toy",
"version": "0.3.3",
"version": "0.4.0",
"description": "Vue toy",
"main": "cjs/Vue.js",
"module": "esm/Vue.js",
Expand Down
17 changes: 10 additions & 7 deletions src/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ export default (options: ComponentOptions) => {
constructor(props: {}) {
super(props);

if (options.errorCaptured || options.renderError) {
this.componentDidCatch = (error: Error) => {
options.errorCaptured?.(error, this);
if (options.renderError) {
this.$children = options.renderError.call(this, React.createElement, error);
this.forceUpdate();
}
};
}

const propsData = Object.create(null);
(options.props || []).forEach((key) => {
propsData[key] = undefined;
Expand Down Expand Up @@ -141,13 +151,6 @@ export default (options: ComponentOptions) => {
options.updated?.call(this);
}

componentDidCatch(error: Error) {
options.errorCaptured?.(error, this);
if (options.renderError) {
this.$children = options.renderError.call(this, React.createElement, error);
}
}

render() {
return this.$children;
}
Expand Down

0 comments on commit c87982c

Please sign in to comment.