@@ -112,12 +112,18 @@ function parseLocals(options, {attrs}, html) {
112
112
// Handle attributes to be merged with default
113
113
// only for Array or Objects
114
114
const mergeAttributeWithDefault = [ ] ;
115
+ const computedAttributes = [ ] ;
115
116
Object . keys ( attributes ) . forEach ( attribute => {
116
117
if ( attribute . startsWith ( 'merge:' ) ) {
117
118
const newAttributeName = attribute . replace ( 'merge:' , '' ) ;
118
119
attributes [ newAttributeName ] = attributes [ attribute ] ;
119
120
delete attributes [ attribute ] ;
120
121
mergeAttributeWithDefault . push ( newAttributeName ) ;
122
+ } else if ( attribute . startsWith ( 'computed:' ) ) {
123
+ const newAttributeName = attribute . replace ( 'computed:' , '' ) ;
124
+ attributes [ newAttributeName ] = attributes [ attribute ] ;
125
+ delete attributes [ attribute ] ;
126
+ computedAttributes . push ( newAttributeName ) ;
121
127
}
122
128
} ) ;
123
129
@@ -152,6 +158,8 @@ function parseLocals(options, {attrs}, html) {
152
158
Object . keys ( locals ) . forEach ( local => {
153
159
if ( mergeAttributeWithDefault . includes ( local ) ) {
154
160
attributes [ local ] = merge ( { ...locals [ local ] } , { ...attributes [ local ] } ) ;
161
+ } else if ( computedAttributes . includes ( local ) ) {
162
+ attributes [ local ] = locals [ local ] ;
155
163
} else if ( typeof attributes [ local ] === 'undefined' ) {
156
164
attributes [ local ] = locals [ local ] ;
157
165
}
0 commit comments