@alexgyver/component 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/component.js +4 -2
- package/package.json +1 -1
package/component.js
CHANGED
|
@@ -75,7 +75,8 @@ export class Component {
|
|
|
75
75
|
context {object} контекст для параметра 'var' и вызовов 'also'
|
|
76
76
|
text {string} добавить в textContent
|
|
77
77
|
html {string} добавить в innerHTML
|
|
78
|
-
|
|
78
|
+
attrs {object} добавить аттрибуты
|
|
79
|
+
props {object} добавить свойства
|
|
79
80
|
class {string} добавить в className
|
|
80
81
|
also {function} - вызвать с текущим компонентом: { ... , also(el) { console.log(el); }, }
|
|
81
82
|
export {array} - положить в 0 ячейку указанного массива
|
|
@@ -115,7 +116,8 @@ export class Component {
|
|
|
115
116
|
case 'var': if (context) context['$' + val] = $el; break;
|
|
116
117
|
case 'events': for (let ev in val) if (val[ev]) $el.addEventListener(ev, val[ev].bind(context)); break;
|
|
117
118
|
case 'parent': if (val instanceof Element) val.append($el); break;
|
|
118
|
-
case '
|
|
119
|
+
case 'attrs': for (let attr in val) $el.setAttribute(attr, val[attr]); break;
|
|
120
|
+
case 'props': for (let prop in val) $el[prop] = val[prop]; break;
|
|
119
121
|
case 'style':
|
|
120
122
|
if (typeof val === 'string') $el.style = val + ';';
|
|
121
123
|
else for (let st in val) $el.style[st] = val[st];
|