當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript query.query函數代碼示例

本文整理匯總了TypeScript中dojo/query.query函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript query函數的具體用法?TypeScript query怎麽用?TypeScript query使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了query函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: override

 clearSelection: override(function (inherited) {
     inherited(arguments);
     query("input[type=checkbox]", this.domNode).forEach(function (node) {
         node.checked = false;
         node.indeterminate = false;
     });
 }),
開發者ID:Michael-Gardner,項目名稱:HPCC-Platform,代碼行數:7,代碼來源:ESPUtil.ts

示例2: query

			def.callback(function (xmlDoc) {
				var results = query('bar', xmlDoc);

				assert.strictEqual(results.length, 2);
			}),
開發者ID:dasa,項目名稱:typings,代碼行數:5,代碼來源:xhr.ts

示例3: query

import * as query from 'dojo/query';

/* An example of working with query and NodeLists */

/* Querying all the nodes of the current document.  The will default to the node
  list being an array of Nodes */
const results = query('*');

/* Now we are going to assert that we will be only returning HTML elements,
  this now means resulting functions will be typed appropriately */
results
    .filter<HTMLElement>((node) => node.parentElement === document.body)
    .forEach((item) => {
        /* item is typed as HTMLElement */
        console.log(item.tagName);
    });

/* If we want to assert what types of nodes our query will return, we can do that
  upfront */

const myDiv = document.createElement('div');
const myP = document.createElement('p');

query<HTMLDivElement>('div')
    .concat(myDiv)
    .forEach((div) => {
        console.log(div.noWrap);
    });

/* it will also type guard us, for example, if you uncomment the below, you will
  throw a type error */
開發者ID:ca0v,項目名稱:typings,代碼行數:31,代碼來源:main.ts


注:本文中的dojo/query.query函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。