parent
1f8f541d7f
commit
c632f41e75
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@bd/core",
|
||||
"version": "1.2.2",
|
||||
"version": "1.3.0",
|
||||
"type": "module",
|
||||
"description": "百搭UI组件库的核心",
|
||||
"main": "dist/index.js",
|
||||
|
|
|
@ -120,7 +120,9 @@ export function parsePropsDeclaration(options) {
|
|||
options = getType(options)
|
||||
break
|
||||
}
|
||||
options.default = options.default || getDefaultValue(options.type)
|
||||
options.default = options.hasOwnProperty('default')
|
||||
? options.default
|
||||
: getDefaultValue(options.type)
|
||||
options.attribute = true
|
||||
return options
|
||||
}
|
||||
|
@ -128,7 +130,7 @@ export function parsePropsDeclaration(options) {
|
|||
export function fixedValue(value, options) {
|
||||
switch (options.type) {
|
||||
case Number:
|
||||
return +value || 0
|
||||
return value === null ? null : +value || 0
|
||||
break
|
||||
|
||||
case Boolean:
|
||||
|
@ -160,7 +162,7 @@ export function fixedValue(value, options) {
|
|||
break
|
||||
|
||||
default:
|
||||
return value + ''
|
||||
return value === null ? null : value + ''
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,9 @@ export class Component extends HTMLElement {
|
|||
return
|
||||
}
|
||||
this[key] = value
|
||||
if (options.observer) {
|
||||
options.observer.call(this, value, oldValue)
|
||||
}
|
||||
this.#requestUpdate(name, oldValue)
|
||||
},
|
||||
enumerable: false
|
||||
|
|
Loading…
Reference in New Issue