Skip to content

[Runtime]: cannot access props, attrs, emits from render function #84

Closed
@ubugeeei

Description

@ubugeeei

related: #47 (comment)

I implemented Component's Proxy in the PR that implements props, but found that it was erased in this commit.

Without it, I don't know how to access props from the render function, since the ctx I receive as argument to the render function does not include props.

this issue blocks #81, #42, #47, #54


I am assuming the following code, or am I wrong? 🤔

const Comp = defineComponent({
  props: ['foo'],
  setup() {
    const __returned__ = {}
    Object.defineProperty(__returned__, '__isScriptSetup', {
      enumerable: false,
      value: true,
    })
    return __returned__
  },
  render(_ctx: any) {
    const t0 = template('<div></div>')
    const n0 = t0()
    const {
      0: [n1],
    } = children(n0)
    watchEffect(() => {
      setText(n1, void 0, _ctx.foo) // here!
    })
    return n0
  },
})

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions