有时,我们希望在程序运行的时候,可以动态的创建元素。可以这样来实现:
在 Assitant 的 setup 方法中调用 Element 的 insert 方法,如下例所示:
MyAssistant.prototype.setup = function()
{
...
var allElem = this.controller.select("*");
// add the spinner before the first element
allElem[0].insert({before : '<div x-mojo-element="Spinner" >
});
...
}
{
...
var allElem = this.controller.select("*");
// add the spinner before the first element
allElem[0].insert({before : '<div x-mojo-element="Spinner" >
});
...
}