Skip to content

Commit e6b9288

Browse files
committed
fix: use dataOriginal if path includes collection
1 parent 112675b commit e6b9288

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/index.js

+1-19
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const CoCreateRender = {
1010
try {
1111
if(typeof json == 'undefined' || !path)
1212
return false;
13-
if (path.indexOf('.') == -1)
13+
if (path.indexOf('.') == -1 && path.includes('collection'))
1414
json = this.dataOriginal
1515
let jsonData = json, subpath = path.split('.');
1616

@@ -64,18 +64,8 @@ const CoCreateRender = {
6464
data[renderKey]['collection'] = this.dataOriginal[renderKey]['collection']
6565

6666
let value = self.__getValue(data, attr);
67-
// if (value) {
68-
// if (value && typeof(value) !== "object") {
69-
// if (value && !Array.isArray(value)) {
7067
if (value) {
71-
// converts object to string
72-
// if (!Array.isArray(value) && typeof(value) == "object") {
7368
if (typeof(value) == "object") {
74-
// let str = '';
75-
// for (const [key, val] of Object.entries(value)) {
76-
// str += `${key}: ${val}\n`;
77-
// }
78-
7969
value = this.generateString(value)
8070
}
8171
isPass = true;
@@ -117,7 +107,6 @@ const CoCreateRender = {
117107
const renderKey = template.getAttribute('render-key') || type;
118108
const self = this;
119109

120-
// const arrayData = this.__getValueFromObject(data, type);
121110
let arrayData = data;
122111

123112
const isRenderObject = template.hasAttribute('render-object');
@@ -199,7 +188,6 @@ const CoCreateRender = {
199188
attrValue = that.__replaceValue(data, attrValue, renderKey);
200189

201190
if (attrValue || attrValue == "") {
202-
// el[renderPaceholder] = {attribute: attr_name ,placeholder: attr.value}
203191
el.setAttribute(attr_name, attrValue);
204192
}
205193
});
@@ -246,12 +234,6 @@ const CoCreateRender = {
246234
this.render(elements[0], data);
247235
else
248236
this.setValue(elements, data);
249-
// for (let element of elements) {
250-
// if (element.classList.contains('template'))
251-
// this.render(element, data);
252-
// else
253-
// this.setValue([element], data);
254-
// }
255237
}
256238

257239
}

0 commit comments

Comments
 (0)