本文整理汇总了TypeScript中@dojo/framework/widget-core/vdom.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: Registry
import renderer from '@dojo/framework/widget-core/vdom';
import { w } from '@dojo/framework/widget-core/d';
import { registerRouterInjector } from '@dojo/framework/routing/RouterInjector';
import TodoApp from './widgets/TodoApp';
import Registry from '@dojo/framework/widget-core/Registry';
const registry = new Registry();
const router = registerRouterInjector([
{
path: 'filter/{filter}',
outlet: 'filter',
defaultParams: { filter: 'all' },
defaultRoute: true
}
], registry);
const r = renderer(() => w(TodoApp, {}));
r.mount({ registry });
开发者ID:dojo,项目名称:examples,代码行数:18,代码来源:main.ts
示例2: router
add("build-time-render", false);
}
const registry = new Registry();
let context: Context;
registry.defineInjector('state', (invalidator) => {
context = new Context(invalidator);
return () => context;
});
function router() {
const [, route = 'top', id = '1'] = window.location.hash.split('/');
if (route === 'user') {
context.route = 'user';
} else if (route === 'comments') {
if (id !== context.itemId || context.route !== 'comments') {
context.fetchItem(id);
}
} else {
if (route !== context.category || parseInt(id, 10) !== context.page || context.route !== 'content') {
context.fetchStories(route, parseInt(id, 10));
}
}
}
window.onhashchange = router;
router();
const r = renderer(() => w(AppContainer, {}));
r.mount({ domNode: document.getElementById('app') as HTMLElement, registry });
开发者ID:dojo,项目名称:examples,代码行数:30,代码来源:main.ts
示例3: renderer
import renderer from '@dojo/framework/widget-core/vdom';
import { w } from '@dojo/framework/widget-core/d';
import App from './widgets/App';
const r = renderer(() => w(App, {}));
r.mount();
开发者ID:dojo,项目名称:examples,代码行数:7,代码来源:main.ts
示例4: _onSelected
import { WidgetBase } from '@dojo/framework/widget-core/WidgetBase';
import { w } from '@dojo/framework/widget-core/d';
import renderer from '@dojo/framework/widget-core/vdom';
import { Menu } from './widgets/Menu';
import { MenuItem } from './widgets/MenuItem';
class Example extends WidgetBase {
private _onSelected(data: any) {
console.log(data);
}
protected render() {
return w(Menu, { onSelected: this._onSelected }, [
w(MenuItem, { key: 'a', title: 'Menu Item A' }),
w(MenuItem, { key: 'b', title: 'Menu Item B', selected: true }),
w(MenuItem, { key: 'c', title: 'Menu Item C' })
]);
}
}
const element = document.getElementById('widget') as HTMLElement;
const r = renderer(() => w(Example, {}));
r.mount({ domNode: element });
开发者ID:dojo,项目名称:examples,代码行数:24,代码来源:main.ts
示例5: _onThemechange
import '@dojo/themes/dojo/index.css';
const themes: { [index: string]: any } = {
dojo,
vanilla: undefined
};
const registry = new Registry();
const themeContext = registerThemeInjector(dojo, registry);
registry.defineInjector('theme-context', () => {
return () => ({
get: () => themeContext,
set: (theme: string) => themeContext.set(theme)
});
});
let initialAppState = {
registry,
themes: Object.keys(themes),
onThemeChange: _onThemechange
}
function _onThemechange(theme: string) {
themeContext.set(themes[theme]);
}
const r = renderer(() => w(App, initialAppState));
r.mount({ registry });
开发者ID:dojo,项目名称:examples,代码行数:30,代码来源:main.ts
注:本文中的@dojo/framework/widget-core/vdom.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论