|
1 | 1 | /** |
2 | | - * vue-custom-element v3.2.4 |
| 2 | + * vue-custom-element v3.2.5 |
3 | 3 | * (c) 2018 Karol Fabjańczuk |
4 | 4 | * @license MIT |
5 | 5 | */ |
@@ -160,7 +160,7 @@ function convertAttributeValue(value, overrideType) { |
160 | 160 | var valueParsed = parseFloat(propsValue, 10); |
161 | 161 | var isNumber = !isNaN(valueParsed) && isFinite(propsValue) && typeof propsValue === 'string' && !propsValue.match(/^0+[^.]\d*$/g); |
162 | 162 |
|
163 | | - if (overrideType && overrideType !== Boolean) { |
| 163 | + if (overrideType && overrideType !== Boolean && (typeof propsValue === 'undefined' ? 'undefined' : _typeof(propsValue)) !== overrideType) { |
164 | 164 | propsValue = overrideType(value); |
165 | 165 | } else if (isBoolean || overrideType === Boolean) { |
166 | 166 | propsValue = propsValue === '' ? true : propsValue === 'true'; |
@@ -251,7 +251,11 @@ function getPropsData(element, componentDefinition, props) { |
251 | 251 | type = props.types[propCamelCase]; |
252 | 252 | } |
253 | 253 |
|
254 | | - propsData[propCamelCase] = propValue instanceof Attr ? convertAttributeValue(propValue.value, type) : propValue; |
| 254 | + if (propValue instanceof Attr) { |
| 255 | + propsData[propCamelCase] = convertAttributeValue(propValue.value, type); |
| 256 | + } else if (typeof propValue !== 'undefined') { |
| 257 | + propsData[propCamelCase] = propValue; |
| 258 | + } |
255 | 259 | }); |
256 | 260 |
|
257 | 261 | return propsData; |
@@ -395,7 +399,7 @@ function createVueInstance(element, Vue, componentDefinition, props, options) { |
395 | 399 |
|
396 | 400 | var reactivePropsList = {}; |
397 | 401 | props.camelCase.forEach(function (prop) { |
398 | | - reactivePropsList[prop] = _this[prop]; |
| 402 | + typeof _this[prop] !== 'undefined' && (reactivePropsList[prop] = _this[prop]); |
399 | 403 | }); |
400 | 404 |
|
401 | 405 | return reactivePropsList; |
|
0 commit comments