Subscribe on changes!

Bug in bool props in <custom-element>

avatar
Sep 21st 2021

Version

3.2.12

Reproduction link

https://codepen.io/catsmeatman/pen/qBjYeve

Steps to reproduce

  1. Define as Vue component (Vue.defineCustomElement)
  2. Bind some bool prop with value "true"
  3. Use prop in template and see value is false.

What is expected?

Prop value will bee true

What is actually happening?

Bool type is not correctly

In standard Vue component, not , this case is work correctly. See https://codepen.io/catsmeatman/pen/rNwvXgQ

avatar
Sep 21st 2021

This is because you are using Vue template syntax (:test-value="true") in plain HTML.

avatar
Sep 22nd 2021

Did i understand correctly? Read this doc https://v3.vuejs.org/guide/web-components.html#passing-dom-properties, that in case i must use

<test-case :test-value.prop="true"></test-case> or <test-case .test-value="true"></test-case>

avatar
Sep 22nd 2021

This is only possible when using custom elements inside Vue templates, because it's Vue's binding syntax.

You are not using the custom element inside a Vue template. You are using it inside plain HTML.

avatar
Sep 22nd 2021

Thanks