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