当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Container.Container函数代码示例

本文整理汇总了TypeScript中@dojo/framework/widget-core/Container.Container函数的典型用法代码示例。如果您正苦于以下问题:TypeScript Container函数的具体用法?TypeScript Container怎么用?TypeScript Container使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Container函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getProperties

	addTodo,
	todoInput,
	removeTodo,
	toggleTodo,
	toggleTodos,
	clearCompleted,
	editTodo,
	saveTodo
} from './../actions/todoActions';

function getProperties({ store }: ReduxInjectorPayload<any, any>) {
	const state = store.getState();

	return {
		addTodo: () => store.dispatch(addTodo()),
		todoInput: (todo: string) => store.dispatch(todoInput(todo)),
		removeTodo: (id: string) => store.dispatch(removeTodo(id)),
		toggleTodo: (id: string) => store.dispatch(toggleTodo(id)),
		toggleTodos: () => store.dispatch(toggleTodos()),
		clearCompleted: () => store.dispatch(clearCompleted()),
		editTodo: (id: string) => store.dispatch(editTodo(id)),
		saveTodo: (id: string, label?: string) => store.dispatch(saveTodo(id, label)),
		currentTodo: state.currentTodo,
		completedCount: state.completedCount,
		activeCount: state.activeCount,
		todos: state.todos
	};
}

export const TodoAppContainer = Container(TodoApp, 'application-state', { getProperties });
开发者ID:dojo,项目名称:examples,代码行数:30,代码来源:TodoAppContainer.ts

示例2: getProperties

import { Container } from '@dojo/framework/widget-core/Container';
import { Context } from './../Context';
import { App } from './../widgets/App';

function getProperties(context: Context, properties: any): any {
	return {
		route: context.route
	};
}

export const AppContainer = Container(App, 'state', { getProperties });
开发者ID:dojo,项目名称:examples,代码行数:11,代码来源:AppContainer.ts

示例3: getProperties

import { Container } from '@dojo/framework/widget-core/Container';
import { Context } from './../Context';
import { Comments, CommentsProperties } from './../widgets/Comments';

function getProperties(context: Context, properties: CommentsProperties): CommentsProperties {
	const { id } = properties;

	return {
		item: context.item,
		id
	};
}

export const CommentsContainer = Container(Comments, 'state', { getProperties });
开发者ID:dojo,项目名称:examples,代码行数:14,代码来源:CommentsContainer.ts

示例4: getProperties

import { Container } from '@dojo/framework/widget-core/Container';
import { Context } from './../Context';
import { Menu, MenuProperties } from './../widgets/Menu';

function getProperties(context: Context, properties: MenuProperties): MenuProperties {
	return {
		currentCategory: context.category
	};
}

export const MenuContainer = Container(Menu, 'state', { getProperties });
开发者ID:dojo,项目名称:examples,代码行数:11,代码来源:MenuContainer.ts


注:本文中的@dojo/framework/widget-core/Container.Container函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。