Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in custom-element components not correct handling type #4370

Closed
catsmeatman opened this issue Aug 17, 2021 · 2 comments
Closed

in custom-element components not correct handling type #4370

catsmeatman opened this issue Aug 17, 2021 · 2 comments
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: custom elements

Comments

@catsmeatman
Copy link

Version

3.2.4

Reproduction link

https://codepen.io/pawel-golubew/pen/OJmeLvV

Steps to reproduce

  1. Define component
const ShowPhoneNumber = Vue.defineCustomElement({
    props: {
        phone: String
    },
    template: `<div>Phone number is: {{phone}}</div>`,
});

customElements.define('show-phone-number', ShowPhoneNumber);
  1. Use component
<show-phone-number phone="8-909-952-45-93"></show-phone-number>
  1. Show in console
[Vue warn]: Invalid prop: type check failed for prop "phone". Expected String with value "8", got Number with value 8. 
  at <App phone=8 > warn$1 @ vue@next:8290

What is expected?

Show number 8-909-952-45-93 as string

What is actually happening?

Show only first char string

@yyx990803 yyx990803 added 🐞 bug Something isn't working scope: custom elements 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Aug 18, 2021
@ygj6
Copy link
Member

ygj6 commented Aug 18, 2021

There are some bugs here:
https://github.com/vuejs/vue-next/blob/872b3f7ec5e1a41c60018bb1f64d841c309b8939/packages/runtime-dom/src/apiCustomElement.ts#L248-L250
Will convert attribute to number.

@akibrk
Copy link

akibrk commented Sep 7, 2021

Any update on this?

@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: custom elements
Projects
None yet
5 participants
@yyx990803 @catsmeatman @ygj6 @akibrk and others