Pattern: Use of life-cycle hook after await
Issue: -
This rule reports the life-cycle hooks after await
expression.
In setup()
function, onXXX
life-cycle hooks should be registered synchronously.
<script>
import { onMounted } from 'vue'
export default {
async setup() {
/* ✓ GOOD */
onMounted(() => { /* ... */ })
await doSomething()
/* ✗ BAD */
onMounted(() => { /* ... */ })
}
}
</script>