@@ -13,6 +13,17 @@ function convertValidator(validator) {
1313 return validator ;
1414}
1515
16+ function attributesDirective ( el , binding , vnode ) {
17+ let attrs = objGet ( vnode . context , "schema.attributes" , { } ) ;
18+ let container = binding . value || "input" ;
19+ if ( isString ( container ) ) {
20+ attrs = objGet ( attrs , container ) || attrs ;
21+ }
22+ forEach ( attrs , ( val , key ) => {
23+ el . setAttribute ( key , val ) ;
24+ } ) ;
25+ }
26+
1627export default {
1728 props : [ "model" , "schema" , "formOptions" , "disabled" ] ,
1829
@@ -26,17 +37,9 @@ export default {
2637
2738 directives : {
2839 attributes : {
29- bind : function ( el , binding , vnode ) {
30- let attrs = objGet ( vnode . context , "schema.attributes" , { } ) ;
31- let container = binding . value || "input" ;
32- if ( isString ( container ) ) {
33- attrs = objGet ( attrs , container , { } ) ;
34- }
35- forEach ( attrs , ( val , key ) => {
36- console . log ( "v-attributes" , key , val ) ;
37- el . setAttribute ( key , val ) ;
38- } ) ;
39- }
40+ bind : attributesDirective ,
41+ updated : attributesDirective ,
42+ componentUpdated : attributesDirective ,
4043 }
4144 } ,
4245
0 commit comments