Skip to content

How to perfectly expose the methods under "expose" in component secondary development #13298

Closed
@gaylen1

Description

@gaylen1

Vue version

3.5.3

Link to minimal reproduction

no

Steps to reproduce

no

What is expected?

Give me an example
For example, the method of exposing the ref component of the elementplus framework's el input component should be implemented using this principle for external exposure.

code

const input= ref();
const expose = {};

onMounted(() => {
const entries = Object.entries(input.value);
for (const [method, fn] of entries) {
expose[method] = fn;
}
});

defineExpose(expose);

Is there a more perfect way?

What is actually happening?

no

System Info

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions