This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues/pull-requests.
yutent
/
anot.js
Archived
1
0
Fork 0
anot.js/src/18-:css.js

26 lines
549 B
JavaScript
Raw Permalink Normal View History

2018-08-04 16:26:50 +08:00
//样式定义 :css-width="200"
//:css="{width: 200}"
Anot.directive('css', {
init: directives.attr.init,
update: function(val) {
var $elem = Anot(this.element)
if (this.param) {
$elem.css(this.param, val)
} else {
if (typeof val !== 'object') {
return log(
':css指令格式错误 %c %s="%s"',
'color:#f00',
this.name,
this.expr
)
}
2018-08-04 16:26:50 +08:00
var obj = val
if (!Anot.isPlainObject(obj)) {
obj = val.$model
2018-08-04 16:26:50 +08:00
}
$elem.css(obj)
2018-08-04 16:26:50 +08:00
}
}
})