@@ -105,32 +105,26 @@ public function convertNode(DOMNode $node): DOMNode
105
105
$ currentComponent = $ this ->components [$ node ->nodeName ];
106
106
$ this ->handleIf ($ node );
107
107
$ this ->handleFor ($ node );
108
+
108
109
if ($ node ->hasAttributes ()) {
109
110
/** @var DOMAttr $attribute */
110
111
foreach ($ node ->attributes as $ attribute ) {
111
112
if (strpos ($ attribute ->name , 'v-bind: ' ) === 0 || strpos ($ attribute ->name , ': ' ) === 0 ) {
112
- $ currentComponent ->addProperty ($ attribute ->name , $ attribute ->value , true );
113
- } else {
114
- $ currentComponent ->addProperty ($ attribute ->name , $ attribute ->value , false );
115
- }
116
- }
117
- }
118
- $ props = [];
119
- if (count ($ currentComponent ->getProperties ()) > 0 ) {
120
- foreach ($ currentComponent ->getProperties () as $ property ) {
121
- if ($ property ->isBinding ()){
122
- $ propName = substr ($ property ->getName (), 1 ); //delete ':'
123
- $ props [] = $ propName .': ' .$ property ->getValue ();
113
+ $ name = substr ($ attribute ->name , strpos ($ attribute ->name , ': ' ) + 1 );
114
+ $ currentComponent ->addProperty ($ name , $ attribute ->value , true );
124
115
} else {
125
- $ props [] = $ property -> getName (). ' : " ' .$ property -> getValue () .'" ' ;
116
+ $ currentComponent -> addProperty ( $ attribute -> name , ' " ' .$ attribute -> value .'" ' , false ) ;
126
117
}
127
118
}
128
119
}
129
- $ propsString = '' ;
130
- if (count ($ props ) > 0 ) {
131
- $ propsString = 'with { ' .implode (', ' , $ props ).' } ' ;
132
- }
133
- $ include = $ this ->document ->createTextNode ('{% include " ' .$ currentComponent ->getPath ().'" ' .$ propsString .'%} ' );
120
+
121
+ $ include = $ this ->document ->createTextNode (
122
+ $ this ->builder ->createIncludePartial (
123
+ $ currentComponent ->getPath (),
124
+ $ currentComponent ->getProperties ()
125
+ )
126
+ );
127
+
134
128
$ node ->parentNode ->insertBefore ($ include , $ node );
135
129
$ node ->parentNode ->removeChild ($ node );
136
130
return $ node ;
0 commit comments