How to perfectly expose the methods under "expose" in component secondary development #13299
Unanswered
gaylen1
asked this question in
Help/Questions
Replies: 1 comment
-
我用过你这样的方式,它存在一个警告,生产环境某些组件会失效。我el-table就失效过 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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
Beta Was this translation helpful? Give feedback.
All reactions