أنا جديد في Ember. هل الدالة h المستخدمة في بعض الصفحات لبناء HTML جزء من مشروع Ember؟ لم أتمكن من العثور على وثائق عنها.
البحث عن “ember h javascript” لا يفيد.
المشكلة المحددة التي أحاول حلها هي إضافة سمة بيانات إلى وسم script أقوم بإنشائه.
على سبيل المثال:
h("script", {src: "http://localhost:5000/pass.js", "data-space": "123"}),
هذا الإنشاء يولّد وسم script يحتوي على src الصحيح، لكن سمة data-space مفقودة.
tshenry
(Taylor)
26 يوليو 2019، 9:32ص
2
أجل، نعم. الوثيقة الوحيدة التي نستشهد بها والتي تمكنت من العثور عليها هي https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/README.md، وهي نوعًا ما مخفية في قاعدة الكود لدينا ضمن تعليق حتى مع وجودها، لم أتمكن من العثور على الإجابة التي تبحث عنها هناك. على أي حال، هناك موضوع هنا في Meta يحتوي على الحل:
لذا، بناءً على الكود الذي قدمته، يجب أن يعمل إذا قمت بتغييره إلى ما يلي:
h("script", { src: "http://localhost:5000/pass.js", attributes: { "data-space": "123" } }),
eviltrout
(Robin Ward)
26 يوليو 2019، 8:51م
3
هناك أيضًا منشور يشرح كيفية عمل جزء الـ Virtual DOM / الـ Widget في Discourse:
This is out of date. See Widgets, the Widget API and their roadmap?
The latest builds of Discourse are much faster at rendering topics thanks to our re-written post stream . I’ve written up our new plugin API but so far haven’t explained how the code all fits together. The purpose of this topic is to allow Discourse developers to understand how the new code works.
What’s a Virtual DOM?
A Virtual DOM is a data structure that enables browsers to re-render dynamic content very quickly. The techniq…