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