當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。