You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is where vue checks whether propsdata property exists. since the properties exist with undefined value, absent is always false due to using this mechanism:
constpropValue=element.attributes[name]||element[propCamelCase];// ...// ...// ensure propsData is only set if `propsValue` exists.if(propValueinstanceofAttr){propsData[propCamelCase]=convertAttributeValue(propValue.value,type)}elseif(typeofpropValue!=='undefined')propsData[propCamelCase]=propValue;}
The text was updated successfully, but these errors were encountered:
djabor
changed the title
getPropsData() sets propsData for all props regardless of existence. collides with require validation
getPropsData() sets propsData for all props regardless of attribute existence. collides with require validation
Aug 8, 2018
djabor
changed the title
getPropsData() sets propsData for all props regardless of attribute existence. collides with require validation
getPropsData() sets propsData for all props regardless of attribute existence. collides with require validation
Aug 8, 2018
djabor
changed the title
getPropsData() sets propsData for all props regardless of attribute existence. collides with require validation
getPropsData() sets propsData for all props regardless of attribute existence. collides with 'required' validation
Aug 8, 2018
thanks, I hadn't had the time to debug it in depth, but I noticed that I missed a few more locations requiring fixes to this issue's end. I'll give it a spin later today! thanks.
Setting a required prop, but not setting the attribute on the HTML element:
expected behavior: setting
{ required: true }
for a prop, should fail validation, in dev mode it should show aconsole.error
.actual behavior:
required
validation succeeds and collides with subsequent validations. e.g. asserting type.vue-custom-element/src/utils/props.js
Line 125 in 41b7f6f
using the custom elements in a document, without the required [
required:true
] props results in a bypassed validation.https://github.com/vuejs/vue/blob/81e1e47cabbd479e2a285f03120944f1efffe749/src/core/util/props.js#L28
is where vue checks whether propsdata property exists. since the properties exist with
undefined
value,absent
is alwaysfalse
due to using this mechanism:https://github.com/vuejs/vue/blob/653aac2c57d15f0e93a2c1cc7e6fad156658df19/src/shared/util.js#L139
as a result, the validation check:
https://github.com/vuejs/vue/blob/81e1e47cabbd479e2a285f03120944f1efffe749/src/core/util/props.js#L107
always fails to enter the condition.
suggested fix:
The text was updated successfully, but these errors were encountered: