vuejs/vue

<script setup>supports defineExpose(), which cannot be exported correctly

bbhxwl opened this issue · 2 comments

Version

2.7.14

Reproduction link

http://b/

Steps to reproduce

The following code may not find a method, but it can be used normally in Vue3.

v1.vue
let searchList=()=>{
//tb.value.btnSearchAdlData(data);
}
defineExpose({
searchList
})

v2.vue
const tbGateMagnet = ref(null);
tbGateMagnet.value.searchList();

What is expected?

The following code may not find a method, but it can be used normally in Vue3.

What is actually happening?

The following code may not find a method, but it can be used normally in Vue3.


The following code may not find a method, but it can be used normally in Vue3.

在 v2.vue 的 onMounted 之后再调用 tbGateMagnet.value.searchList();

在 v2.vue 的 onMounted 之后再调用 tbGateMagnet.value.searchList();

多谢,我脑子坏了。