This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修复attr判断

old
宇天 2017-12-21 04:42:36 +08:00
parent c06d29dae1
commit ef7fa7cee7
1 changed files with 20 additions and 22 deletions

View File

@ -3080,11 +3080,6 @@
if (events[type]) { if (events[type]) {
param = type param = type
type = 'on' type = 'on'
} else if (obsoleteAttrs[type]) {
param = type
type = 'attr'
name = ':' + type + '-' + param
log('warning!请改用' + name + '代替' + attr.name + '!')
} }
if (directives[type]) { if (directives[type]) {
var newValue = value.replace(roneTime, '') var newValue = value.replace(roneTime, '')
@ -3232,23 +3227,14 @@
if (vmodels.length) { if (vmodels.length) {
attrs.forEach(function(attr, i) { attrs.forEach(function(attr, i) {
if (/^:/.test(attr.name)) { if (/^:/.test(attr.name)) {
var name = attr.name.replace(':', '') var name = attr.name.match(rmsAttr)[1]
var value = null var value = null
if (Anot.directives[name]) { if (!name || Anot.directives[name]) {
return return
} }
try { try {
value = parseExpr(attr.value, vmodels, {}).apply(0, vmodels) value = parseExpr(attr.value, vmodels, {}).apply(0, vmodels)
elem.removeAttribute(attr.name) elem.removeAttribute(attr.name)
} catch (error) {
log(
'Props parse faild on (%s[class=%s]),',
elem.nodeName,
elem.className,
attr,
error + ''
)
}
if (!value) { if (!value) {
return return
} }
@ -3259,11 +3245,23 @@
if (newVmodel.props[name].check(value)) { if (newVmodel.props[name].check(value)) {
newVmodel.props[name] = value newVmodel.props[name] = value
} else { } else {
Anot.error('props「' + name + '」类型错误!' + value, TypeError) Anot.error(
'props「' + name + '」类型错误!' + value,
TypeError
)
} }
} else { } else {
newVmodel.props[name] = value newVmodel.props[name] = value
} }
} catch (error) {
log(
'Props parse faild on (%s[class=%s]),',
elem.nodeName,
elem.className,
attr,
error + ''
)
}
} }
}) })
} }