Skip to content

Commit

Permalink
add call setup
Browse files Browse the repository at this point in the history
cuixiaorui committed Jan 28, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent d8c09f1 commit ad1ab41
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/runtime-core/component.ts
Original file line number Diff line number Diff line change
@@ -36,13 +36,15 @@ function setupStatefulComponent(instance) {
// todo
// 1. 先创建代理 proxy
console.log("创建 proxy");
const Component = instance.type;
// 2. 调用 setup

// 调用 setup 的时候传入 props
// TODO 还需要传入 setupContext
const setupContext = createSetupContext();
const setupResult =
instance.setup && instance.setup(instance.props, setupContext);
const { setup } = Component;
if (setup) {
const setupContext = createSetupContext();
const setupResult = setup && setup(instance.props, setupContext);
}

// 3. 处理 setupResult
handleSetupResult(instance, setupResult);

0 comments on commit ad1ab41

Please sign in to comment.