如何让其他 JS 库与 maquette js 一起工作?

How to make other JS libraries work with maquette js?

我们想在现有系统中使用模型。使其他第 3 方库(例如 select2,bootstrap 工具提示修改 DOM 到位)在 maquette 中发挥良好的最佳实践是什么?

虽然问题很宽泛,但答案很简单。 Maquette 提供了 aftercreate and afterupdate 回调,可用于修改 DOM that maquette created/updated。您可以使用 element 参数来调用第 3 方库。

Maquette 不会介意 DOM 节点是否被第 3 方库修改。只要它们没有完全移除或更换,它就可以正常工作。还有 afterremoved 回调可以用来正确销毁 widget/component/whatever。