增加容错处理
parent
4ebf74f40f
commit
12b4417a94
|
@ -301,7 +301,7 @@ export class Component extends HTMLElement {
|
|||
* @param value<String|Boolean|Number>
|
||||
*/
|
||||
#prop2attr(name, value) {
|
||||
let options = this.#getPropOptions(name)
|
||||
let options = this.#getPropOptions(name) || {}
|
||||
let attrName = options.attrName
|
||||
|
||||
if (options.attribute === false) {
|
||||
|
@ -344,6 +344,8 @@ export class Component extends HTMLElement {
|
|||
propName = camelize(name)
|
||||
|
||||
options = this.#getPropOptions(propName)
|
||||
|
||||
if (options) {
|
||||
value = fixedValue(value, options)
|
||||
|
||||
if (options.attribute === false) {
|
||||
|
@ -355,6 +357,7 @@ export class Component extends HTMLElement {
|
|||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this[propName] = value
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue