本文整理匯總了TypeScript中@angular/platform-browser/src/browser/browser_adapter.BrowserDomAdapter.query方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserDomAdapter.query方法的具體用法?TypeScript BrowserDomAdapter.query怎麽用?TypeScript BrowserDomAdapter.query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/platform-browser/src/browser/browser_adapter.BrowserDomAdapter
的用法示例。
在下文中一共展示了BrowserDomAdapter.query方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: autoInit
static autoInit() {
const specUrlAttributeName = 'spec-url';
let redocEl = dom.query('redoc');
if (!redocEl) return;
if (dom.hasAttribute(redocEl, specUrlAttributeName)) {
let url = dom.getAttribute(redocEl, specUrlAttributeName);
Redoc.init(url);
}
}
示例2: hideLoadingAnimation
static hideLoadingAnimation() {
let redocEl = dom.query('redoc');
if (!redocEl) return;
dom.addClass(redocEl, 'loading-remove');
setTimeout(() => {
dom.removeClass(redocEl, 'loading-remove');
dom.removeClass(redocEl, 'loading');
}, 400);
}
示例3: displayError
static displayError(err) {
let redocEl = dom.query('redoc');
if (!redocEl) return;
let heading = 'Oops... ReDoc failed to render this spec';
let details = err.message;
let erroHtml = `<div class="redoc-error">
<h1>${heading}</h1>
<div class='redoc-error-details'>${details}</div>`;
redocEl.innerHTML = erroHtml;
}
示例4: destroy
static destroy() {
let el = dom.query('redoc');
let elClone;
let parent;
let nextSibling;
if (el) {
parent = el.parentElement;
nextSibling = el.nextElementSibling;
}
elClone = el.cloneNode(false);
if (Redoc.appRef) {
Redoc.appRef.destroy();
Redoc.appRef = null;
// Redoc destroy removes host element, so need to restore it
elClone.innerHTML = 'Loading...';
if (parent) parent.insertBefore(elClone, nextSibling);
}
}
示例5: _normalizeOptions
_normalizeOptions() {
// modify scrollYOffset to always be a function
if (!isFunction(this._options.scrollYOffset)) {
if (isFinite(this._options.scrollYOffset)) {
// if number specified create function that returns this value
let numberOffset = parseFloat(this._options.scrollYOffset);
this.options.scrollYOffset = () => numberOffset;
} else {
// if selector or node function that returns bottom offset of this node
let el = this._options.scrollYOffset;
if (!(el instanceof Node)) {
el = this.dom.query(el);
}
if (!el) {
this._options.scrollYOffset = () => 0;
} else {
this._options.scrollYOffset = () => el.offsetTop + el.offsetHeight;
}
}
}
if (isString(this._options.disableLazySchemas)) this._options.disableLazySchemas = true;
if (isString(this._options.suppressWarnings)) this._options.suppressWarnings = true;
}
示例6: openModal
openModal(modalName) {
let dialog = this._dom.query("ct-dialog." + this.metricShortName.toLowerCase() + "Modal");
dialog.showModal();
}
示例7: showLoadingAnimation
static showLoadingAnimation() {
let elem = dom.query('redoc');
dom.addClass(elem, 'loading');
}