为什么我无法在子组件为异步steup的时候,获取到子组件的方法 #9294
Answered
by
edison1105
2507483326
asked this question in
Help/Questions
-
我定义了一个异步子组件,我想在父组件中执行子组件中暴露出来的方法,但是不行,我想知道为什么,以及我该如何修改我的代码,
子组件
我无法在父组件中执行test方法,设置change的值 |
Beta Was this translation helpful? Give feedback.
Answered by
edison1105
Sep 27, 2023
Replies: 2 comments
-
<script setup>
import { ref } from 'vue'
// 写到 await 的上面
let change = ref(null)
defineExpose({test: () => {change.value = 'change'}})
await wait();
async function wait () {}
</script> see #4930 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
2507483326
-
https://eslint.vuejs.org/rules/no-expose-after-await.html#vue-no-expose-after-await
|
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
see #4930