@@ -41,7 +41,6 @@ const CoCreateRender = {
41
41
return this . __getValueFromObject ( data , result [ 1 ] . trim ( ) ) ;
42
42
}
43
43
return false ;
44
-
45
44
} ,
46
45
47
46
__createObject : function ( data , path ) {
@@ -219,11 +218,17 @@ const CoCreateRender = {
219
218
return cloneEl ;
220
219
} ,
221
220
221
+ document_id : '' ,
222
222
setValue : function ( els , data , renderArray , renderKey ) {
223
223
if ( ! data ) return ;
224
224
let isRenderKey
225
225
if ( data . renderKey )
226
226
isRenderKey = true
227
+
228
+ if ( data . document_id || data . data && data . data . _id ) {
229
+ let id = data . document_id || data . data . _id ;
230
+ this . document_id = id ;
231
+ }
227
232
228
233
const that = this ;
229
234
Array . from ( els ) . forEach ( el => {
@@ -280,6 +285,12 @@ const CoCreateRender = {
280
285
// ToDo support attibute name replace if has {{}}
281
286
// attr_name = that.__replaceValue(data, attr_name, renderKey);
282
287
288
+ if ( attr . value == "{{data._id}}" || attr . value == "{{document_id}}" ) {
289
+ // if(data.data || data.document_id) {
290
+ // let id = data.data._id || data.document_id;
291
+ el . setAttribute ( attr_name , this . document_id ) ;
292
+ // }
293
+ }
283
294
if ( attrValue || attrValue == "" ) {
284
295
el . setAttribute ( attr_name , attrValue ) ;
285
296
}
@@ -473,6 +484,9 @@ observer.init({
473
484
for ( let data of array . reverse ( ) ) {
474
485
obj = { ...obj , ...data }
475
486
}
487
+
488
+ if ( ! obj [ 'document_id' ] && obj . data . _id )
489
+ obj [ 'document_id' ] = obj . data . _id
476
490
477
491
CoCreateRender . data ( {
478
492
elements : [ element ] ,
0 commit comments