本文整理汇总了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');
}