We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d98917c commit ca79cdbCopy full SHA for ca79cdb
1 file changed
src/index.js
@@ -66,6 +66,22 @@ function init(element) {
66
await render({ source: element[i], data });
67
element[i].getData = () => sources.get(element[i]).data;
68
}
69
+
70
+ let dataAttr = element[i].getAttribute("render-data");
71
72
+ if (dataAttr) {
73
+ try {
74
+ // Parse the string into a usable object
75
+ const parsedData = JSON.parse(dataAttr);
76
77
+ // Ensure the method exists before calling it
78
+ if (typeof element[i].renderValue === "function") {
79
+ element[i].renderValue(parsedData);
80
+ }
81
+ } catch (error) {
82
+ console.error("Failed to parse render-data:", error);
83
84
85
86
87
0 commit comments