Subscribe on changes!

Props not available in life-cycle hooks in custom elements

avatar
Oct 1st 2021

Version

3.2.19

Reproduction link

github.com

Steps to reproduce

General

  1. Create a custom element
  2. Try using the life-cycle hooks to access the props.

Reproduction through the example

  1. Clone the repo provided
  2. Run npm i --save
  3. Run npm run build:wc
  4. Copy the output into lab directory
  5. cd lab then run npx http-server

What is expected?

Expected props to be available in created/mounted/before mount hooks.

What is actually happening?

Props are undefined in setup/onMounted/onBeforeMount or created hooks


This is happening in the defineCustomElement API. Also, it says the attributes have not been passed in console warning, even though the attributes have been passed in.

avatar
Oct 12th 2021

Anything on this?

avatar
Oct 12th 2021

I believe I'm seeing the same problem: https://github.com/vuejs/vue-next/issues/4789

avatar
Oct 13th 2021

I'll send a PR in a few hours

avatar
Nov 2nd 2021

fixed by 3ca8317