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

//样式定义 :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
)
}
var obj = val
if (!Anot.isPlainObject(obj)) {
obj = val.$model
}
$elem.css(obj)
}
}
})
Anot 是Anot not only templateEngine的缩写。 它是一款迷你,易用、高性能的前端MVVM框架, fork于avalon。进行了大量的重构,精简部分冗余的API, 同时针对组件拓展进行了优化。
JavaScript 100%