vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
47.57k stars 8.31k forks source link

[Question] how can I get the error.message in errorComponent #9714

Closed fantasticsoul closed 11 months ago

fantasticsoul commented 11 months ago

Vue version

all

Link to minimal reproduction

https://codesandbox.io/p/sandbox/demo-load-remote-vue3-comp-lazy-forked-93nsyn

Steps to reproduce

visit the demo

What is expected?

I can get err ref or err message string in the ErrComponent

What is actually happening?

currently I can not get err ref or err message string in the ErrComponent by reading defineAsyncComponent doc

System Info

Browsers

Any additional comments?

No response

Alfred-Skyblue commented 11 months ago

errorComponent receives an error prop. You should modify the code accordingly:

export default {
  name: "ErrorComponent",
    props: {
      error: Error,
    },
};

playground

fantasticsoul commented 11 months ago

it works, thx a lot