本文整理匯總了TypeScript中aurelia-framework.DOM類的典型用法代碼示例。如果您正苦於以下問題:TypeScript DOM類的具體用法?TypeScript DOM怎麽用?TypeScript DOM使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DOM類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: fireEvent
export function fireEvent(event: string,
element: EventTarget,
data?: any): any {
let e = DOM.createCustomEvent(event, { bubbles: true, cancelable: true, detail: data });
return element.dispatchEvent(e);
}
示例2: submit
submit(event: Event): void {
let button = event.srcElement;
button.setAttribute("disabled", "disabled");
let comment: Comment = {
body: this.comment,
email: this.email,
name: this.name,
postId: this.postId,
id: 0
};
let evt = DOM.createCustomEvent('save', { bubbles: true, detail: comment });
this.api.saveComment(comment)
.then(_ => this.element.dispatchEvent(evt))
.then(_ => this.reset())
.then(_ => button.removeAttribute("disabled"));
}
示例3: getDialogContainer
/**
* Gets an anchor for the ViewSlot to insert a view into.
* @returns A DOM element.
*/
getDialogContainer() {
return DOM.createElement('div');
}